parent
03eea7f62a
commit
d0372f1730
@ -21,6 +21,7 @@
|
||||
|
||||
import re
|
||||
import os.path
|
||||
import urllib
|
||||
import functools
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot, Qt
|
||||
@ -135,6 +136,7 @@ def _get_suggested_filename(path):
|
||||
"""
|
||||
filename = os.path.basename(path)
|
||||
filename = re.sub(r'\([0-9]+\)$', '', filename)
|
||||
filename = urllib.parse.unquote(filename)
|
||||
return filename
|
||||
|
||||
|
||||
|
BIN
tests/end2end/data/downloads/download with spaces.bin
Normal file
BIN
tests/end2end/data/downloads/download with spaces.bin
Normal file
Binary file not shown.
@ -113,6 +113,11 @@ Feature: Downloading things from a website.
|
||||
And I wait for "Download drip finished" in the log
|
||||
Then the downloaded file drip should contain 128 bytes
|
||||
|
||||
Scenario: Downloading a file with spaces
|
||||
When I open data/downloads/download with spaces.bin without waiting
|
||||
And I wait until the download is finished
|
||||
Then the downloaded file download with spaces.bin should exist
|
||||
|
||||
## :download-retry
|
||||
|
||||
Scenario: Retrying a failed download
|
||||
|
@ -29,6 +29,7 @@ from qutebrowser.browser.webengine import webenginedownloads
|
||||
('foo(1)', 'foo'),
|
||||
('foo(a)', 'foo(a)'),
|
||||
('foo1', 'foo1'),
|
||||
('foo%20bar', 'foo bar'),
|
||||
])
|
||||
def test_get_suggested_filename(path, expected):
|
||||
assert webenginedownloads._get_suggested_filename(path) == expected
|
||||
|
Loading…
Reference in New Issue
Block a user