Handle :// as URL pattern

This commit is contained in:
Florian Bruhin 2018-09-02 11:58:34 +02:00
parent 5f10c9c15f
commit 67b4b7d490
3 changed files with 5 additions and 2 deletions

View File

@ -65,6 +65,7 @@ Fixed
Note it still does not work on Qt 5.10 (due to a Qt bug) and Qt < 5.9.2.
- Repeated escaping of entries in `qute://log` when refreshing page.
- The host blocker doesn't block 0.0.0.0 anymore.
- Crash when using :// as URL pattern
v1.4.1
------

View File

@ -142,7 +142,9 @@ class UrlPattern:
Deviation from Chromium:
- We assume * when no scheme has been given.
"""
assert parsed.scheme, parsed
if not parsed.scheme:
raise ParseError("Missing scheme")
if parsed.scheme == 'any':
self._scheme = None
return

View File

@ -96,7 +96,7 @@ from qutebrowser.utils import urlmatch
("http://[fc2e:bb88:edac]", 'Invalid IPv6 address; source was "fc2e:bb88:edac"; host = ""'),
("http://[fc2e:bb88:edac::z]", 'Invalid IPv6 address; source was "fc2e:bb88:edac::z"; host = ""'),
("http://[fc2e:bb88:edac::2]:2a2", "Invalid port: invalid literal for int() with base 10: '2a2'"),
("://", "Missing scheme"),
])
def test_invalid_patterns(pattern, error):
with pytest.raises(urlmatch.ParseError, match=re.escape(error)):