Fix host_valid()
logic in Vilfo config flow (#49862)
This commit is contained in:
parent
a4db35a16e
commit
0379dee47e
2 changed files with 10 additions and 1 deletions
|
@ -32,7 +32,7 @@ RESULT_INVALID_AUTH = "invalid_auth"
|
|||
def host_valid(host):
|
||||
"""Return True if hostname or IP address is valid."""
|
||||
try:
|
||||
if ipaddress.ip_address(host).version == (4 or 6):
|
||||
if ipaddress.ip_address(host).version in [4, 6]:
|
||||
return True
|
||||
except ValueError:
|
||||
disallowed = re.compile(r"[^a-zA-Z\d\-]")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue