Commit 062aa684 authored by Romain Courteaud's avatar Romain Courteaud

Do not truncate filename when it contains a dot.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32796 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 49c811ae
......@@ -204,7 +204,7 @@ class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin):
raise NotConvertedError
# Else try to convert the document and return it
mime, result = self.convert(format=format, display=display, **kw)
converted_filename = '%s.%s'%(filename.split('.')[0], format)
converted_filename = '%s.%s'%('.'.join(filename.split('.')[:-1]), format)
if not mime:
mime = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format)
RESPONSE.setHeader('Content-Length', len(result))
......
......@@ -595,7 +595,7 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
doc = self.portal.document_module.newContent(
source_reference='test.ods',
portal_type='Spreadsheet')
doc.edit(file=makeFileUpload('import_data_list.ods'))
doc.edit(file=makeFileUpload('import.file.with.dot.in.filename.ods'))
doc.publish()
transaction.commit()
self.tic()
......@@ -609,14 +609,14 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
response = self.publish('%s/Document_convert?format=pdf' % doc.getPath(),
basic='member_user2:secret')
self.assertEquals('application/pdf', response.headers['content-type'])
self.assertEquals('attachment; filename="import_data_list.pdf"',
self.assertEquals('attachment; filename="import.file.with.dot.in.filename.pdf"',
response.headers['content-disposition'])
# test Print icon works on OOoDocument
response = self.publish('%s/OOoDocument_print' % doc.getPath())
self.assertEquals('application/pdf',
response.headers['content-type'])
self.assertEquals('attachment; filename="import_data_list.pdf"',
self.assertEquals('attachment; filename="import.file.with.dot.in.filename.pdf"',
response.headers['content-disposition'])
def test_05_getCreationDate(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