Use toLocalFile function instead of slicing.

This commit is contained in:
Antoni Boucher 2015-08-08 14:13:09 -04:00
parent e6521b047d
commit 2969599390
2 changed files with 1 additions and 2 deletions

View File

@ -161,7 +161,7 @@ class BrowserPage(QWebPage):
return False return False
elif (error_str.endswith('Path is a directory') and elif (error_str.endswith('Path is a directory') and
info.url.scheme() == 'file'): info.url.scheme() == 'file'):
html = dirbrowser(info.url.url()[7:]) html = dirbrowser(info.url.toLocalFile())
errpage.content = html.encode('utf-8') errpage.content = html.encode('utf-8')
errpage.encoding = 'utf-8' errpage.encoding = 'utf-8'
return True return True

View File

@ -36,7 +36,6 @@ class TestFileList:
assert {'name': 'testfile', 'absname': os.path.join(basedir, assert {'name': 'testfile', 'absname': os.path.join(basedir,
'testfile')} in result 'testfile')} in result
"""Test get_file_list with os.path.isdir filter function."""
basedir = os.path.abspath('./qutebrowser/utils') basedir = os.path.abspath('./qutebrowser/utils')
all_files = os.listdir(basedir) all_files = os.listdir(basedir)
result = get_file_list(basedir, all_files, os.path.isdir) result = get_file_list(basedir, all_files, os.path.isdir)