mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 06:31:27 +08:00
fall back for UnicodeDecodeError
This commit is contained in:
parent
85130e175b
commit
3a1af9f424
1 changed files with 5 additions and 1 deletions
|
@ -503,7 +503,11 @@ def parseaddr_unicode(addr) -> (str, str):
|
|||
name = name.strip()
|
||||
decoded_string, charset = decode_header(name)[0]
|
||||
if charset is not None:
|
||||
name = decoded_string.decode(charset)
|
||||
try:
|
||||
name = decoded_string.decode(charset)
|
||||
except UnicodeDecodeError:
|
||||
LOG.warning("Cannot decode addr name %s", name)
|
||||
name = ""
|
||||
else:
|
||||
name = decoded_string
|
||||
|
||||
|
|
Loading…
Reference in a new issue