Commit edb93a0b authored by Ivan Tyagov's avatar Ivan Tyagov

Try to return the original filename.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14109 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8af93c2e
...@@ -76,6 +76,9 @@ class PDFDocument(Image, ConversionCacheMixin): ...@@ -76,6 +76,9 @@ class PDFDocument(Image, ConversionCacheMixin):
it is always a zip because multi-page pdfs are converted into a zip it is always a zip because multi-page pdfs are converted into a zip
file of many images file of many images
""" """
if self.getSourceReference() is not None:
RESPONSE.setHeader('Content-Disposition',
'attachment; filename=%s' %self.getSourceReference())
if format is None: if format is None:
RESPONSE.setHeader('Content-Type', 'application/pdf') RESPONSE.setHeader('Content-Type', 'application/pdf')
return _unpackData(self.data) return _unpackData(self.data)
......
...@@ -142,6 +142,9 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -142,6 +142,9 @@ class OOoDocument(File, ConversionCacheMixin):
_setCacheHeaders(self, {'format' : format}) _setCacheHeaders(self, {'format' : format})
# Return the original file by default # Return the original file by default
if format is None: if format is None:
if self.getSourceReference() is not None:
RESPONSE.setHeader('Content-Disposition',
'attachment; filename=%s' %self.getSourceReference())
return File.index_html(self, REQUEST, RESPONSE) return File.index_html(self, REQUEST, RESPONSE)
# Make sure file is converted to base format # Make sure file is converted to base format
if not self.hasBaseData(): if not self.hasBaseData():
...@@ -378,7 +381,7 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -378,7 +381,7 @@ class OOoDocument(File, ConversionCacheMixin):
return self._base_metadata return self._base_metadata
security.declareProtected(Permissions.ModifyPortalContent, 'updateBaseMetadata') security.declareProtected(Permissions.ModifyPortalContent, 'updateBaseMetadata')
def updateBaseMetadata(self, **kw): def updateBaseMetadata(self, *arg, **kw):
""" """
Updates metadata information in the converted OOo document Updates metadata information in the converted OOo document
based on the values provided by the user. This is implemented based on the values provided by the user. This is implemented
......
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