mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
handle linebreak in parseaddr_unicode
This commit is contained in:
parent
5c8d31111c
commit
03dfafe1cf
@ -572,9 +572,12 @@ def get_spam_from_header(spam_status_header, max_score=None) -> (bool, str):
|
|||||||
|
|
||||||
|
|
||||||
def parseaddr_unicode(addr) -> (str, 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")
|
'=?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)
|
name, email = parseaddr(addr)
|
||||||
# email can have whitespace so we can't remove whitespace here
|
# email can have whitespace so we can't remove whitespace here
|
||||||
email = email.strip().lower()
|
email = email.strip().lower()
|
||||||
|
Loading…
Reference in New Issue
Block a user