From 96c1d53222c04dd4db55752d075dcd9ba52cff67 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 2 Sep 2014 07:11:01 +0200 Subject: [PATCH] urlutils: Strip URL before testing. --- qutebrowser/test/utils/test_url.py | 1 + qutebrowser/utils/urlutils.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/qutebrowser/test/utils/test_url.py b/qutebrowser/test/utils/test_url.py index 2dd858f78..e960b4bc4 100644 --- a/qutebrowser/test/utils/test_url.py +++ b/qutebrowser/test/utils/test_url.py @@ -126,6 +126,7 @@ class IsUrlTests(unittest.TestCase): 'http://foobar', 'localhost:8080', 'qutebrowser.org', + ' qutebrowser.org ', '127.0.0.1', '::1', '2001:41d0:2:6c11::1', diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index 21ffb6a30..5019f8e22 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -193,6 +193,8 @@ def is_url(urlstr): log.url.debug("Checking if '{}' is a URL (autosearch={}).".format( urlstr, autosearch)) + + url = urlstr.strip() qurl = QUrl(urlstr) if not autosearch: