Fix content disposition reading for python < 3.5

This commit is contained in:
Andrey Mozgunov
2017-09-27 13:42:43 +03:00
parent 0a98b960ac
commit 4559149dc0

View File

@@ -147,14 +147,14 @@ def parse_email(raw_email, policy=None):
for part in email_message.walk():
content_type = part.get_content_type()
part_maintype = part.get_content_maintype()
content_disposition = part.get_content_disposition()
content_disposition = part.get('Content-Disposition', None)
if content_disposition or not part_maintype == "text":
content = part.get_payload(decode=True)
else:
content = decode_content(part)
is_inline = content_disposition is None \
or content_disposition == "inline"
or content_disposition.startswith("inline")
if content_type == "text/plain" and is_inline:
body['plain'].append(content)
elif content_type == "text/html" and is_inline: