Try around decode

This commit is contained in:
Antonio J. Delgado 2024-09-28 20:24:56 +03:00
parent c1bfaec431
commit ab56c33c27

View file

@ -132,7 +132,10 @@ class ImapFilter:
data
)
return {"match": False}
part = data[1].decode('utf-8')
try:
part = data[1].decode('utf-8')
except UnicodeDecodeError:
part = data[1]
message = email.message_from_string(part)
decoded_field = email.header.decode_header(message.get(mfilter['field'], ""))
if isinstance(decoded_field[0][0], str):