Add condition to prevent pass `filename*` when it's equal with original `filename`
@@ -39,8 +39,9 @@ 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)
+ if ascii_name != file_name:
+ quoted_name = urllib.parse.quote(file_name)
header += u'; filename*=UTF-8\'\'{}'.format(quoted_name)
return header
