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): ...@@ -198,12 +198,16 @@ class OOoDocument(PermanentURLMixIn, File, ConversionCacheMixin):
converted_filename = '%s.%s'%(filename.split('.')[0], format) converted_filename = '%s.%s'%(filename.split('.')[0], format)
if not mime: if not mime:
mime = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format) mime = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format)
RESPONSE.setHeader('Content-Length', len(result)) if format in STANDARD_IMAGE_FORMAT_LIST:
RESPONSE.setHeader('Content-Type', mime) RESPONSE.setHeader('Content-Type', mime)
RESPONSE.setHeader('Accept-Ranges', 'bytes') return result.index_html(REQUEST, RESPONSE)
RESPONSE.setHeader('Content-Disposition', else:
'attachment; filename="%s"' % converted_filename) RESPONSE.setHeader('Content-Length', len(result))
return 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 # Format conversion implementation
def _getServerCoordinate(self): 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