diff options
author | Magnus Hagander | 2013-01-05 13:11:57 +0000 |
---|---|---|
committer | Magnus Hagander | 2013-01-05 13:11:57 +0000 |
commit | bc9ab0666c6fd3119c5768c09f44673df9790e9b (patch) | |
tree | 4a2616390062d2c1e37848b63879e6d8f9849631 /loader/lib/parser.py | |
parent | c05cf6b47664ab624805507c222ee8908844e48a (diff) |
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...
Diffstat (limited to 'loader/lib/parser.py')
-rw-r--r-- | loader/lib/parser.py | 4 |
1 files changed, 4 insertions, 0 deletions
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*') |