Skip to content

Commit

Permalink
db/message: accept attachments of type pgp-encrypted
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
meskio authored and pazz committed Jan 21, 2019
1 parent 8c25bed commit fd13483
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions alot/db/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,13 @@ def get_attachments(self):
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
Expand Down

0 comments on commit fd13483

Please sign in to comment.