fixing unittests and allowing for single character domains

This commit is contained in:
alwaysjolley
2020-06-03 08:08:49 -04:00
parent 2a1751ec30
commit 8658ac531e
2 changed files with 13 additions and 2 deletions

View File

@ -35,7 +35,7 @@ def is_valid_domain(domain):
domain = domain[:-1]
if len(domain) > 253:
return False
fqdn_re = re.compile("(?=^.{1,63}$)(^(?:[a-z0-9](?:-*[a-z0-9])+)$)", re.IGNORECASE)
fqdn_re = re.compile("(?=^.{1,63}$)(^(?:[a-z0-9](?:-*[a-z0-9])+)|[a-z0-9]$)", re.IGNORECASE)
return all(fqdn_re.match(d) for d in domain.split("."))