diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index 7af8f933a..5417d9a7a 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -212,7 +212,7 @@ def _has_explicit_scheme(url): # symbols, we treat this as not a URI anyways. return (url.isValid() and url.scheme() and (url.host() or url.path()) and - not url.path().startswith(' ') and + ' ' not in url.path() and not url.path().startswith(':')) diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py index 9c7c86741..f98ba65d6 100644 --- a/tests/unit/utils/test_urlutils.py +++ b/tests/unit/utils/test_urlutils.py @@ -333,6 +333,7 @@ def test_get_search_url_invalid(urlutils_config_stub, url): (False, True, False, '1337'), # no DNS because bogus-IP (False, True, True, 'deadbeef'), (False, True, True, 'hello.'), + (False, True, False, 'site:cookies.com oatmeal raisin'), # no DNS because bogus-IP pytest.mark.xfail(qtutils.version_check('5.6.1'), reason='Qt behavior changed')(