1
0
mirror of https://github.com/moepman/acertmgr.git synced 2024-12-29 12:31:52 +01:00

tools: Fix IDNA handler (again)

This commit is contained in:
Kishi85 2020-03-04 14:05:04 +01:00
parent b37d0cad94
commit 0648cb7b38

View File

@ -375,7 +375,8 @@ def target_is_current(target, file):
# @brief convert domain list to idna representation (if applicable # @brief convert domain list to idna representation (if applicable
def idna_convert(domainlist): def idna_convert(domainlist):
if 'idna' in sys.modules and any(ord(c) >= 128 for c in ''.join(domainlist)): if any(ord(c) >= 128 for c in ''.join(domainlist)):
try:
domaintranslation = list() domaintranslation = list()
for domain in domainlist: for domain in domainlist:
if any(ord(c) >= 128 for c in domain): if any(ord(c) >= 128 for c in domain):
@ -389,9 +390,8 @@ def idna_convert(domainlist):
result = domain, domain result = domain, domain
domaintranslation.append(result) domaintranslation.append(result)
return domaintranslation return domaintranslation
else: except Exception as e:
if any(ord(c) >= 128 for c in ''.join(domainlist)) and 'idna' not in sys.modules: log("Unicode domain(s) found but IDNA names could not be translated due to error: {}".format(e), error=True)
log("Unicode domain(s) found but IDNA names could not be translated due to missing idna module", error=True)
return [(x, x) for x in domainlist] return [(x, x) for x in domainlist]