mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
handle linebreak in parseaddr_unicode
This commit is contained in:
parent
5c8d31111c
commit
03dfafe1cf
1 changed files with 4 additions and 1 deletions
|
@ -572,9 +572,12 @@ def get_spam_from_header(spam_status_header, max_score=None) -> (bool, str):
|
|||
|
||||
|
||||
def parseaddr_unicode(addr) -> (str, str):
|
||||
"""Like parseaddr but return name in unicode instead of in RFC 2047 format
|
||||
"""Like parseaddr() but return name in unicode instead of in RFC 2047 format
|
||||
Should be used instead of parseaddr()
|
||||
'=?UTF-8?B?TmjGoW4gTmd1eeG7hW4=?= <abcd@gmail.com>' -> ('Nhơn Nguyễn', "abcd@gmail.com")
|
||||
"""
|
||||
# sometimes linebreaks are present in addr
|
||||
addr = addr.replace("\n", "").strip()
|
||||
name, email = parseaddr(addr)
|
||||
# email can have whitespace so we can't remove whitespace here
|
||||
email = email.strip().lower()
|
||||
|
|
Loading…
Reference in a new issue