From fba2b2b5ae4756c0eafc93026df1cb4a0aac50e0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 2 Feb 2015 22:23:18 +0100 Subject: [PATCH] fuzzy_url: handle invalid URLs with autosearch off Fixes #497. --- qutebrowser/utils/urlutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index dccc16961..5acc97eaa 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -178,7 +178,11 @@ def fuzzy_url(urlstr, cwd=None, relative=False): url = qurl_from_user_input(stripped) log.url.debug("Converting fuzzy term {} to URL -> {}".format( urlstr, url.toDisplayString())) - qtutils.ensure_valid(url) + if config.get('general', 'auto-search'): + qtutils.ensure_valid(url) + else: + if not url.isValid(): + raise FuzzyUrlError("Invalid URL '{}'!".format(urlstr)) return url