diff --git a/qutebrowser/test/test_urlutils.py b/qutebrowser/test/test_urlutils.py index 84d82fee2..8ee1bd418 100644 --- a/qutebrowser/test/test_urlutils.py +++ b/qutebrowser/test/test_urlutils.py @@ -137,6 +137,7 @@ class IsUrlNaiveTests(TestCase): 'foo bar', 'localhost test', 'another . test', + 'foo', ] def test_urls(self): diff --git a/qutebrowser/utils/url.py b/qutebrowser/utils/url.py index f44ae3bdc..3e73c557c 100644 --- a/qutebrowser/utils/url.py +++ b/qutebrowser/utils/url.py @@ -73,11 +73,14 @@ def _is_url_naive(url): True if the url really is an URL, False otherwise. """ protocols = ['http', 'https'] + u = qurl(url) + urlstr = urlstring(url) if isinstance(url, QUrl): u = url else: u = QUrl.fromUserInput(url) - if u.scheme() in protocols: + # We don't use u here because fromUserInput appends http:// automatically. + if any(urlstr.startswith(proto) for proto in protocols): return True elif '.' in u.host(): return True