Avoid crash with LC_ALL=C and unicode filename

This commit is contained in:
Luca Benci 2017-10-20 22:06:59 +02:00
parent 4c2aeb01a8
commit dee0799e15

View File

@ -127,7 +127,10 @@ class FileSchemeHandler(schemehandler.SchemeHandler):
A QNetworkReply for directories, None for files.
"""
path = request.url().toLocalFile()
if os.path.isdir(path):
data = dirbrowser_html(path)
return networkreply.FixedDataNetworkReply(
request, data, 'text/html', self.parent())
try:
if os.path.isdir(path):
data = dirbrowser_html(path)
return networkreply.FixedDataNetworkReply(
request, data, 'text/html', self.parent())
except UnicodeEncodeError:
return None