1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Always store payload parts having a Content-Disposition of 'attachment' as attachments, even if their Content-Type is text/plain. Fixes #52.

Squashed commit of the following:

commit 5bcbac33d6
Author: Adam Coddington <me@adamcoddington.net>
Date:   Tue Jul 7 23:05:15 2015 -0700

    Add handling for situations in which the message was deleted in another thread before processing.

commit 6183f68b39
Author: Adam Coddington <me@adamcoddington.net>
Date:   Tue Jul 7 22:58:15 2015 -0700

    Always store message as attachment if its content-disposition is marked as such.

commit 4c16494b1a
Author: Adam Coddington <me@adamcoddington.net>
Date:   Tue Jul 7 22:46:52 2015 -0700

    Adding a (hopefully) failing test case for #52.
This commit is contained in:
Adam Coddington 2015-07-07 23:09:41 -07:00
parent 95f4d5c7ff
commit ff433a24f4
4 changed files with 53 additions and 2 deletions

View file

@ -103,7 +103,13 @@ class ImapTransport(EmailTransport):
typ, msg_contents = self.server.uid('fetch', uid, '(RFC822)')
if not msg_contents:
continue
message = self.get_email_from_bytes(msg_contents[0][1])
try:
message = self.get_email_from_bytes(msg_contents[0][1])
except TypeError:
# This happens if another thread/process deletes the
# message between our generating the ID list and our
# processing it here.
continue
if condition and not condition(message):
continue