diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-03-06 12:32:45 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-03-06 12:32:45 +0100 |
commit | 172ce9724bb3702faaadc5202a7bd92f9ce938bf (patch) | |
tree | d0bf5206ba42cbff1f72d64cdd467c357cf4b7b4 /alot/db/message.py | |
parent | b3816a9fd256fa7df25edd46a451ae1cf3756aa1 (diff) |
commands/thread: avoid accessing the email directly in pipeto
This also prevents it from modifying the message as it previously did
with add_tags. As a consequence, tags are now added to the beginning of
the message rather than at the end of header.
Diffstat (limited to 'alot/db/message.py')
-rw-r--r-- | alot/db/message.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/alot/db/message.py b/alot/db/message.py index f9092e41..90bba469 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -443,7 +443,12 @@ class Message: filenames = [] for f in msg.get_filenames(): - filenames.append(f[:]) + # FIXME these should be returned as bytes, but the notmuch bindings + # decode them + # this should be resolved by switching to the newer notmuch2 + # bindings + # for now, just re-encode them in utf-8 + filenames.append(f.encode('utf-8')) if len(filenames) == 0: raise ValueError('No filenames for a message returned') self.filenames = filenames @@ -493,8 +498,8 @@ class Message: return self.filenames[0] def _load_email(self, session_keys): - warning = "Subject: Caution!\n"\ - "Message file is no longer accessible:\n%s" % self.filename + warning = b"Subject: Caution!\n"\ + b"Message file is no longer accessible:\n%s" % self.filename try: with open(self.filename, 'rb') as f: mail = _decrypted_message_from_bytes(f.read(), session_keys) |