summaryrefslogtreecommitdiff
path: root/cherrypy/lib
diff options
context:
space:
mode:
authorJan Rieger <jrx@centrum.cz>2020-04-16 16:17:58 +0200
committerSviatoslav Sydorenko <wk@sydorenko.org.ua>2020-04-17 17:56:24 +0200
commit3fb8601b17d30f69dad79d5bd93c8a6180fd013d (patch)
tree4b3c8845c33e373ddbab6b3351e6498419ef3f00 /cherrypy/lib
parentb6e48811e269517e1ea67c6221f94f6e5a500d79 (diff)
downloadcherrypy-git-3fb8601b17d30f69dad79d5bd93c8a6180fd013d.tar.gz
Add condition to prevent pass `filename*` when it's equal with original `filename`
Diffstat (limited to 'cherrypy/lib')
-rw-r--r--cherrypy/lib/static.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cherrypy/lib/static.py b/cherrypy/lib/static.py
index 26643c24..8aae1de1 100644
--- a/cherrypy/lib/static.py
+++ b/cherrypy/lib/static.py
@@ -39,9 +39,10 @@ def _make_content_disposition(disposition, file_name):
unicodedata.normalize('NFKD', file_name).
encode('ascii', errors='ignore').decode()
)
- quoted_name = urllib.parse.quote(file_name)
header = u'{}; filename="{}"'.format(disposition, ascii_name)
- header += u'; filename*=UTF-8\'\'{}'.format(quoted_name)
+ if ascii_name != file_name:
+ quoted_name = urllib.parse.quote(file_name)
+ header += u'; filename*=UTF-8\'\'{}'.format(quoted_name)
return header