From 4559149dc02733eaefdba063969d02459f0e81d3 Mon Sep 17 00:00:00 2001 From: Andrey Mozgunov Date: Wed, 27 Sep 2017 13:42:43 +0300 Subject: [PATCH] Fix content disposition reading for python < 3.5 --- imbox/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imbox/parser.py b/imbox/parser.py index 9f741b1..538ba5c 100644 --- a/imbox/parser.py +++ b/imbox/parser.py @@ -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: