urlmatch: Improve matching error for TLD wildcards
This commit is contained in:
parent
fa329c698e
commit
3d6cbcf396
@ -119,7 +119,11 @@ class UrlPattern:
|
|||||||
host_parts = host_parts[1:]
|
host_parts = host_parts[1:]
|
||||||
self._match_subdomains = True
|
self._match_subdomains = True
|
||||||
self._host = '.'.join(host_parts)
|
self._host = '.'.join(host_parts)
|
||||||
if '*' in self._host:
|
|
||||||
|
if self._host.endswith('.*'):
|
||||||
|
# Special case to have a nicer error
|
||||||
|
raise ParseError("TLD wildcards are not implemented yet")
|
||||||
|
elif '*' in self._host:
|
||||||
# Only * or *.foo is allowed as host.
|
# Only * or *.foo is allowed as host.
|
||||||
raise ParseError("Invalid host wildcard")
|
raise ParseError("Invalid host wildcard")
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ from qutebrowser.utils import urlmatch
|
|||||||
("http://*foo/bar", "Invalid host wildcard"),
|
("http://*foo/bar", "Invalid host wildcard"),
|
||||||
("http://foo.*.bar/baz", "Invalid host wildcard"),
|
("http://foo.*.bar/baz", "Invalid host wildcard"),
|
||||||
("http://fo.*.ba:123/baz", "Invalid host wildcard"),
|
("http://fo.*.ba:123/baz", "Invalid host wildcard"),
|
||||||
("http://foo.*/bar", "Invalid host wildcard"),
|
("http://foo.*/bar", "TLD wildcards are not implemented yet"),
|
||||||
|
|
||||||
# Chromium: PARSE_ERROR_INVALID_PORT
|
# Chromium: PARSE_ERROR_INVALID_PORT
|
||||||
("http://foo:/", "Empty port"),
|
("http://foo:/", "Empty port"),
|
||||||
|
Loading…
Reference in New Issue
Block a user