Unexpected exception from EmailAddress.full_spec
horkhe opened this issue · 0 comments
horkhe commented
Found in version: 0.6.8
It is possible for EmailAddress.full_spec
function to raise an exception even if EmailAddress.require_non_ascii
returns False
, see a stack trace below:
Traceback (most recent call last):
File "/app/src/flanker/flanker/mime/message/headers/encoding.py", line 37, in encode
return encode_unstructured(name, value)
File "/app/src/flanker/flanker/mime/message/headers/encoding.py", line 52, in encode_unstructured
return encode_address_header(name, value)
File "/app/src/flanker/flanker/mime/message/headers/encoding.py", line 65, in encode_address_header
out.append(addr.full_spec().encode('utf-8'))
File "/app/src/flanker/flanker/addresslib/address.py", line 536, in full_spec
ace_hostname = self.hostname.encode('idna')
File "/usr/lib/python2.7/encodings/idna.py", line 164, in encode
result.append(ToASCII(label))
File "/usr/lib/python2.7/encodings/idna.py", line 76, in ToASCII
label = nameprep(label)
File "/usr/lib/python2.7/encodings/idna.py", line 38, in nameprep
raise UnicodeError("Invalid character %r" % c)
UnicodeError: Invalid character u'\u200e'
That breaks the mutual contract of these functions.