mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
email.message_from_string can also throw LookupError when non-existent charset is set
This commit is contained in:
parent
b4e5e3eecb
commit
f16676e921
@ -636,7 +636,7 @@ def copy(msg: Message) -> Message:
|
|||||||
try:
|
try:
|
||||||
# prefer the unicode way
|
# prefer the unicode way
|
||||||
return email.message_from_string(msg.as_string())
|
return email.message_from_string(msg.as_string())
|
||||||
except (UnicodeEncodeError, KeyError):
|
except (UnicodeEncodeError, KeyError, LookupError):
|
||||||
LOG.warning("as_string() fails, try to_bytes")
|
LOG.warning("as_string() fails, try to_bytes")
|
||||||
return email.message_from_bytes(to_bytes(msg))
|
return email.message_from_bytes(to_bytes(msg))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user