mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 14:43:32 +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()
|
name = name.strip()
|
||||||
decoded_string, charset = decode_header(name)[0]
|
decoded_string, charset = decode_header(name)[0]
|
||||||
if charset is not None:
|
if charset is not None:
|
||||||
|
try:
|
||||||
name = decoded_string.decode(charset)
|
name = decoded_string.decode(charset)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
LOG.warning("Cannot decode addr name %s", name)
|
||||||
|
name = ""
|
||||||
else:
|
else:
|
||||||
name = decoded_string
|
name = decoded_string
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue