prevent error when converting idn to ascii strings. Fixes #7995
This commit is contained in:
parent
a17ff4b45e
commit
512840944b
1 changed files with 4 additions and 1 deletions
|
@ -123,7 +123,10 @@ def idn_to_ascii(host):
|
|||
labels = idna.dots.split(host)
|
||||
converted_labels = []
|
||||
for label in labels:
|
||||
converted_labels.append(idna.ToASCII(label).decode('utf-8'))
|
||||
if label:
|
||||
converted_labels.append(idna.ToASCII(label).decode('utf-8'))
|
||||
else:
|
||||
converted_labels.append('')
|
||||
return ".".join(converted_labels)
|
||||
|
||||
def ascii_to_idn(host):
|
||||
|
|
Loading…
Add table
Reference in a new issue