parent
98f0938d35
commit
6989d4d210
@ -104,6 +104,11 @@ def create_full_filename(basename, filename):
|
||||
Return:
|
||||
The full absolute path, or None if filename creation was not possible.
|
||||
"""
|
||||
# Remove chars which can't be encoded in the filename encoding.
|
||||
# See https://github.com/The-Compiler/qutebrowser/issues/427
|
||||
encoding = sys.getfilesystemencoding()
|
||||
filename = utils.force_encoding(filename, encoding)
|
||||
basename = utils.force_encoding(basename, encoding)
|
||||
if os.path.isabs(filename) and os.path.isdir(filename):
|
||||
# We got an absolute directory from the user, so we save it under
|
||||
# the default filename in that directory.
|
||||
@ -523,10 +528,6 @@ class DownloadItem(QObject):
|
||||
"existing: {}, fileobj {}".format(
|
||||
filename, self._filename, self.fileobj))
|
||||
filename = os.path.expanduser(filename)
|
||||
# Remove chars which can't be encoded in the filename encoding.
|
||||
# See https://github.com/The-Compiler/qutebrowser/issues/427
|
||||
encoding = sys.getfilesystemencoding()
|
||||
filename = utils.force_encoding(filename, encoding)
|
||||
self._filename = create_full_filename(self.basename, filename)
|
||||
if self._filename is None:
|
||||
# We only got a filename (without directory) or a relative path
|
||||
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Test starting qutebrowser with various commandline arguments."""
|
||||
"""Test starting qutebrowser with special arguments/environments."""
|
||||
|
||||
import pytest
|
||||
|
||||
@ -51,3 +51,23 @@ def test_no_config(tmpdir, quteproc_new):
|
||||
quteproc_new.start(args, env=env)
|
||||
quteproc_new.send_cmd(':quit')
|
||||
quteproc_new.wait_for_quit()
|
||||
|
||||
|
||||
@pytest.mark.linux
|
||||
def test_ascii_locale(httpbin, tmpdir, quteproc_new):
|
||||
"""Test downloads with LC_ALL=C set.
|
||||
|
||||
https://github.com/The-Compiler/qutebrowser/issues/908
|
||||
"""
|
||||
args = ['--debug', '--no-err-windows', '--temp-basedir', 'about:blank']
|
||||
quteproc_new.start(args, env={'LC_ALL': 'C'})
|
||||
quteproc_new.set_setting('storage', 'download-directory', str(tmpdir))
|
||||
quteproc_new.set_setting('storage', 'prompt-download-directory', 'false')
|
||||
url = 'http://localhost:{port}/data/downloads/ä-issue908.bin'.format(
|
||||
port=httpbin.port)
|
||||
quteproc_new.send_cmd(':download {}'.format(url))
|
||||
quteproc_new.send_cmd(':quit')
|
||||
quteproc_new.wait_for_quit()
|
||||
|
||||
assert len(tmpdir.listdir()) == 1
|
||||
assert (tmpdir / '?-issue908.bin').exists()
|
||||
|
Loading…
Reference in New Issue
Block a user