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

display converted result in the browser if requested format is standard image format.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29137 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent abcc6e21
......@@ -198,12 +198,16 @@ class OOoDocument(PermanentURLMixIn, File, ConversionCacheMixin):
converted_filename = '%s.%s'%(filename.split('.')[0], format)
if not mime:
mime = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format)
RESPONSE.setHeader('Content-Length', len(result))
RESPONSE.setHeader('Content-Type', mime)
RESPONSE.setHeader('Accept-Ranges', 'bytes')
RESPONSE.setHeader('Content-Disposition',
'attachment; filename="%s"' % converted_filename)
return result
if format in STANDARD_IMAGE_FORMAT_LIST:
RESPONSE.setHeader('Content-Type', mime)
return result.index_html(REQUEST, RESPONSE)
else:
RESPONSE.setHeader('Content-Length', len(result))
RESPONSE.setHeader('Content-Type', mime)
RESPONSE.setHeader('Accept-Ranges', 'bytes')
RESPONSE.setHeader('Content-Disposition',
'attachment; filename="%s"' % converted_filename)
return result
# Format conversion implementation
def _getServerCoordinate(self):
......
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