Commit 7bdc6008 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

getStandardFileName() should be called with the passed format argument, not...

getStandardFileName() should be called with the passed format argument, not with the guessed format value.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40263 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a866a686
......@@ -86,18 +86,20 @@ class DownloadableMixin:
mimetype_object_list = mimetypes_registry.lookup(mime)
for mimetype_object in mimetype_object_list:
if mimetype_object.extensions:
format = mimetype_object.extensions[0]
output_format = mimetype_object.extensions[0]
break
elif mimetype_object.globs:
format = mimetype_object.globs.strip('*.')
output_format = mimetype_object.globs.strip('*.')
break
else:
output_format = format
RESPONSE.setHeader('Content-Length', len(data))
if format in VALID_TEXT_FORMAT_LIST:
if output_format in VALID_TEXT_FORMAT_LIST:
RESPONSE.setHeader('Content-Type', '%s; charset=utf-8' % mime)
else:
RESPONSE.setHeader('Content-Type', mime)
if format not in (VALID_TEXT_FORMAT_LIST + VALID_IMAGE_FORMAT_LIST):
if output_format not in (VALID_TEXT_FORMAT_LIST + VALID_IMAGE_FORMAT_LIST):
# need to return it as attachment
filename = self.getStandardFileName(format=format)
RESPONSE.setHeader('Content-Disposition',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment