Skip to content

Commit 06a2c49

Browse files
committed
Merge branch 'master' of https://github.com/dddomodossola/remi
2 parents ba6bc53 + 56c1518 commit 06a2c49

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

remi/gui.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
unescape = html.unescape
4545

4646
from .server import runtimeInstances
47-
47+
try:
48+
from urllib.parse import quote
49+
except ImportError:
50+
from urllib import quote
4851

4952
log = logging.getLogger('remi.gui')
5053

@@ -4165,8 +4168,9 @@ def __init__(self, text, filename, path_separator='/', *args, **kwargs):
41654168
def download(self):
41664169
with open(self._filename, 'rb') as f:
41674170
content = f.read()
4171+
filename = quote(os.path.basename(self._filename))
41684172
headers = {'Content-type': 'application/octet-stream',
4169-
'Content-Disposition': 'attachment; filename="%s"' % os.path.basename(self._filename)}
4173+
'Content-Disposition': 'attachment; filename="{0}"; filename*=UTF-8\'\'{0}'.format(filename)}
41704174
return [content, headers]
41714175

41724176

0 commit comments

Comments
 (0)