Don't treat any valid int as IP
This commit is contained in:
parent
7be32dd70c
commit
6973050ccc
@ -85,12 +85,18 @@ def _is_url_naive(urlstr):
|
|||||||
else:
|
else:
|
||||||
# Valid IPv4/IPv6 address
|
# Valid IPv4/IPv6 address
|
||||||
return True
|
return True
|
||||||
if re.search(r'^([0-9.]+|0x[a-fA-F0-9]+)$', urlstr):
|
|
||||||
# Qt treats things like "23.42" or "1337" or "0xDEAD" as valid URLs
|
# Qt treats things like "23.42" or "1337" or "0xDEAD" as valid URLs
|
||||||
# which we don't want to. Note we already filtered *real* valid IPs
|
# which we don't want to. Note we already filtered *real* valid IPs
|
||||||
# above.
|
# above.
|
||||||
|
try:
|
||||||
|
int(urlstr, 0)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
return False
|
return False
|
||||||
elif not url.isValid():
|
|
||||||
|
if not url.isValid():
|
||||||
return False
|
return False
|
||||||
elif '.' in url.host():
|
elif '.' in url.host():
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user