diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2019-11-03 15:06:23 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-11-21 09:11:38 +0000 |
commit | f57505160af4304b5f99a83beb2316a12dcc90aa (patch) | |
tree | 6ec01b3fa547393958cd6387acd54c76abb7a421 | |
parent | b01caf2039e22ad3b6aef7c3ffcff7d38e3faf6b (diff) |
sanitize message text for display
This ensures that non-printable characters (tabs) are replaced in the
message body texts in envelope buffers and in source texts in thread
mode.
fix #1439
-rw-r--r-- | alot/buffers/envelope.py | 3 | ||||
-rw-r--r-- | alot/widgets/thread.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/alot/buffers/envelope.py b/alot/buffers/envelope.py index 45b2809f..ae2972d7 100644 --- a/alot/buffers/envelope.py +++ b/alot/buffers/envelope.py @@ -9,6 +9,7 @@ from ..settings.const import settings from ..widgets.globals import HeadersList from ..widgets.globals import AttachmentWidget from ..helper import shorten_author_string +from ..helper import string_sanitize class EnvelopeBuffer(Buffer): @@ -88,7 +89,7 @@ class EnvelopeBuffer(Buffer): self.attachment_wgt = urwid.Pile(lines) displayed_widgets.append(self.attachment_wgt) - self.body_wgt = urwid.Text(self.envelope.body) + self.body_wgt = urwid.Text(string_sanitize(self.envelope.body)) displayed_widgets.append(self.body_wgt) self.body = urwid.ListBox(displayed_widgets) diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index 0085ad34..ca05ebd9 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -12,6 +12,7 @@ from .globals import TagWidget from .globals import AttachmentWidget from ..settings.const import settings from ..db.utils import decode_header, X_SIGNATURE_MESSAGE_HEADER +from ..helper import string_sanitize class MessageSummaryWidget(urwid.WidgetWrap): @@ -244,6 +245,7 @@ class MessageTree(CollapsibleTree): def _get_source(self): if self._sourcetree is None: sourcetxt = self._message.get_email().as_string() + sourcetxt = string_sanitize(sourcetxt) att = settings.get_theming_attribute('thread', 'body') att_focus = settings.get_theming_attribute('thread', 'body_focus') self._sourcetree = TextlinesList(sourcetxt, att, att_focus) |