mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
email.message_from_string can also throw KeyError when 'content-transfer-encoding' is absent
This commit is contained in:
parent
632a5bbbc8
commit
4666d21f63
1 changed files with 1 additions and 1 deletions
|
@ -636,7 +636,7 @@ def copy(msg: Message) -> Message:
|
|||
try:
|
||||
# prefer the unicode way
|
||||
return email.message_from_string(msg.as_string())
|
||||
except UnicodeEncodeError:
|
||||
except (UnicodeEncodeError, ValueError):
|
||||
LOG.warning("as_string() fails, try to_bytes")
|
||||
return email.message_from_bytes(to_bytes(msg))
|
||||
|
||||
|
|
Loading…
Reference in a new issue