From bc9ab0666c6fd3119c5768c09f44673df9790e9b Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sat, 5 Jan 2013 14:11:57 +0100 Subject: [PATCH] Properly parse attachments of type=text/plain, content-disposition=attachment Previously we'd only parse them if they were given an explicit name, which is not required - instead, they can have a filename... --- loader/lib/parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loader/lib/parser.py b/loader/lib/parser.py index 543a535..033cb1e 100644 --- a/loader/lib/parser.py +++ b/loader/lib/parser.py @@ -297,6 +297,10 @@ class ArchivesParser(object): # Yes, it has a name self.attachments.append((self._extract_filename(container), container.get_content_type(), container.get_payload(decode=True))) return + # If it's content-disposition=attachment, we also want to save it + if container.has_key('Content-Disposition') and container['Content-Disposition'].startswith('attachment'): + self.attachments.append((self._extract_filename(container), container.get_content_type(), container.get_payload(decode=True))) + return # No name, and text/plain, so ignore it re_msgid = re.compile('^\s*<(.*)>\s*') -- 2.39.5