1
0
Fork 0

fix message.text exception when attachment filename header contains weird characters

Add failing test for bad header character

fix

add comment
This commit is contained in:
Adam Reisinger 2024-04-25 12:22:30 +02:00
parent 376bcff6bf
commit 488c726c2d
4 changed files with 339 additions and 2 deletions

View file

@ -103,7 +103,7 @@ def get_body_from_message(message, maintype, subtype):
"""
body = ''
for part in message.walk():
if part.get('content-disposition', '').startswith('attachment;'):
if convert_header_to_unicode(part.get('content-disposition', '')).startswith('attachment;'):
continue
if part.get_content_maintype() == maintype and \
part.get_content_subtype() == subtype: