mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
Filename surrounded by double quotes.
Chrome will give a Duplicate Header error if a file name has a comma in it, and the file name is not surrounded by double quotes.
This commit is contained in:
parent
5c262dfa52
commit
7b2d8215e6
1 changed files with 2 additions and 2 deletions
|
|
@ -77,9 +77,9 @@ def content_disposition(filename):
|
|||
ascii_filename = encode_basename_ascii(filename)
|
||||
utf8_filename = encode_basename_utf8(filename)
|
||||
if ascii_filename == utf8_filename: # ASCII only.
|
||||
return "attachment; filename={ascii}".format(ascii=ascii_filename)
|
||||
return "attachment; filename=\"{ascii}\"".format(ascii=ascii_filename)
|
||||
else:
|
||||
return "attachment; filename={ascii}; filename*=UTF-8''{utf8}" \
|
||||
return "attachment; filename=\"{ascii}\"; filename*=UTF-8''\"{utf8}\"" \
|
||||
.format(ascii=ascii_filename,
|
||||
utf8=utf8_filename)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue