diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-11-04 20:20:02 -0600 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-01-21 13:49:23 +0000 |
commit | fd1348329b8697d9bb014e7d61560f3421d29e46 (patch) | |
tree | 0b2962a306237785bd55b3adf383affbd435335b | |
parent | 8c25bed24d7729d99d8bfe3417627ce1500da6c2 (diff) |
db/message: accept attachments of type pgp-encrypted
In case of a '.gpg' file being attached to a non-encrypted email some
email clients (like thunderbird) will mark this attachment as content
type 'application/pgp-encrypted'. Alot used to discard that mime part
because the same content type is being used in PGP/MIME to signal de
version:
https://tools.ietf.org/html/rfc3156#section-6.1
Now alot differenciates two cases:
* Normal PGP/MIME encrypted messages, where we need to discard the
'application/pgp-encrypted' mime part. Detected because this part is
followed by a 'application/octet-stream' mime part.
* A mime part with aplication/pgp-encrypted as content type, that is
displayed as attachment.
-rw-r--r-- | alot/db/message.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/alot/db/message.py b/alot/db/message.py index ae06acc6..b9a474d7 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -252,10 +252,13 @@ class Message(object): if ct in ['octet/stream', 'application/octet-stream']: content = part.get_payload(decode=True) ct = helper.guess_mimetype(content) + if (self._attachments and + self._attachments[-1].get_content_type() == + 'application/pgp-encrypted'): + self._attachments.pop() if cd.lower().startswith('attachment'): - if ct.lower() not in ['application/pgp-encrypted', - 'application/pgp-signature']: + if ct.lower() not in ['application/pgp-signature']: self._attachments.append(Attachment(part)) elif cd.lower().startswith('inline'): if (filename is not None and |