diff --git a/qutebrowser/utils/urlmatch.py b/qutebrowser/utils/urlmatch.py index 49551cba2..cf6a5d4da 100644 --- a/qutebrowser/utils/urlmatch.py +++ b/qutebrowser/utils/urlmatch.py @@ -119,7 +119,11 @@ class UrlPattern: host_parts = host_parts[1:] self._match_subdomains = True 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. raise ParseError("Invalid host wildcard") diff --git a/tests/unit/utils/test_urlmatch.py b/tests/unit/utils/test_urlmatch.py index ff24053db..496a14c7f 100644 --- a/tests/unit/utils/test_urlmatch.py +++ b/tests/unit/utils/test_urlmatch.py @@ -52,7 +52,7 @@ from qutebrowser.utils import urlmatch ("http://*foo/bar", "Invalid host wildcard"), ("http://foo.*.bar/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 ("http://foo:/", "Empty port"),