Fails to validate URL for local file:
from validators import url
url("file:///var/www") # ValidationError(func=url, args={'value': 'file:///var/www'})
Excpected True, because this URL type standartizated in RFC 8089.
Error in _validate_netloc() function. It expected domain like var.com, but see directory var.
ValidationError(
func=hostname,
args={'value': 'var', 'skip_ipv6_addr': True, 'skip_ipv4_addr': False, 'may_have_port': True, 'maybe_simple': False, 'consider_tld': False, 'private': None, 'rfc_1034': False, 'rfc_2782': False}
)
May be we should skip netloc validation in some cases like file and add file scheme in _validate_scheme() function.
Works this code, but is it correct behaviour for common URL scheme?
from validators import url
url("file:///var/www", simple_host = True, validate_scheme = lambda x: x == "file") # True
Fails to validate URL for local file:
Excpected
True, because this URL type standartizated in RFC 8089.Error in
_validate_netloc()function. It expected domain like var.com, but see directory var.May be we should skip netloc validation in some cases like
fileand addfilescheme in_validate_scheme()function.Works this code, but is it correct behaviour for common URL scheme?