Fix content disposition reading for python < 3.5
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user