From 4500bc24d4073f1d7fc615f96024167400743ae3 Mon Sep 17 00:00:00 2001 From: Tarcisio Fedrizzi Date: Fri, 26 Feb 2016 08:01:06 +0100 Subject: [PATCH] fuzzy_url uses path check function --- qutebrowser/utils/urlutils.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index 54a55dd9b..723f2c62f 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -171,22 +171,10 @@ def fuzzy_url(urlstr, cwd=None, relative=False, do_search=True): A target QUrl to a search page or the original URL. """ urlstr = urlstr.strip() - expanded = os.path.expanduser(urlstr) + path = get_path_if_valid(urlstr, cwd = cwd, relative = relative, + check_exists = True) - if os.path.isabs(expanded): - path = expanded - elif relative and cwd: - path = os.path.join(cwd, expanded) - elif relative: - try: - path = os.path.abspath(expanded) - except OSError: - path = None - else: - path = None - - if path is not None and os.path.exists(path): - log.url.debug("URL is a local file") + if path is not None: url = QUrl.fromLocalFile(path) elif (not do_search) or is_url(urlstr): # probably an address