email_mirror: Fix exception for emails with no valid content type.

If a broken email shows up with no text or email content-type, we
were attempting to return an undefined variable.
This commit is contained in:
Tim Abbott 2017-07-13 22:19:49 -07:00
parent c7c533fd4d
commit 786b339b96

View File

@ -215,8 +215,7 @@ def get_message_part_by_type(message, content_type):
content = part.get_payload(decode=True)
assert isinstance(content, binary_type)
if charsets[idx]:
text = content.decode(charsets[idx], errors="ignore")
return text
return content.decode(charsets[idx], errors="ignore")
return None
def extract_body(message):