From 6183f68b39f292c6c6fe489b8b08b0b4332f8e3a Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Tue, 7 Jul 2015 22:58:15 -0700 Subject: [PATCH] Always store message as attachment if its content-disposition is marked as such. --- django_mailbox/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django_mailbox/models.py b/django_mailbox/models.py index d227af5..4324cd8 100644 --- a/django_mailbox/models.py +++ b/django_mailbox/models.py @@ -298,7 +298,10 @@ class Mailbox(models.Model): ) ) new.set_payload('') - elif msg.get_content_type() not in TEXT_STORED_MIMETYPES: + elif ( + (msg.get_content_type() not in TEXT_STORED_MIMETYPES) or + ('attachment' in msg.get('Content-Disposition', '')) + ): filename = msg.get_filename() if not filename: extension = mimetypes.guess_extension(msg.get_content_type())