From 2969599390593561a6819025aa1e957688daf440 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Sat, 8 Aug 2015 14:13:09 -0400 Subject: [PATCH] Use toLocalFile function instead of slicing. --- qutebrowser/browser/webpage.py | 2 +- tests/browser/test_dirbrowser.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index db8cb0871..f5d6fe675 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -161,7 +161,7 @@ class BrowserPage(QWebPage): return False elif (error_str.endswith('Path is a directory') and info.url.scheme() == 'file'): - html = dirbrowser(info.url.url()[7:]) + html = dirbrowser(info.url.toLocalFile()) errpage.content = html.encode('utf-8') errpage.encoding = 'utf-8' return True diff --git a/tests/browser/test_dirbrowser.py b/tests/browser/test_dirbrowser.py index cca017338..ebfee4bc0 100644 --- a/tests/browser/test_dirbrowser.py +++ b/tests/browser/test_dirbrowser.py @@ -36,7 +36,6 @@ class TestFileList: assert {'name': 'testfile', 'absname': os.path.join(basedir, 'testfile')} in result - """Test get_file_list with os.path.isdir filter function.""" basedir = os.path.abspath('./qutebrowser/utils') all_files = os.listdir(basedir) result = get_file_list(basedir, all_files, os.path.isdir)