From 1febcb9fce933a4045395b9b7164c3c0051511a3 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 26 Jun 2018 15:39:16 +1200 Subject: [PATCH] Also call sanitize_filename in TempDownloadManager Just in case the suggested name used for the temp file suffix somehow has an illegal character in it. --- qutebrowser/browser/downloads.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 27408ffd6..517d93638 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -1224,8 +1224,7 @@ class TempDownloadManager: A tempfile.NamedTemporaryFile that should be used to save the file. """ tmpdir = self._get_tmpdir() - encoding = sys.getfilesystemencoding() - suggested_name = utils.force_encoding(suggested_name, encoding) + suggested_name = utils.sanitize_filename(suggested_name) # Make sure that the filename is not too long suggested_name = utils.elide_filename(suggested_name, 50) fobj = tempfile.NamedTemporaryFile(dir=tmpdir.name, delete=False,