Commit 7e35d0e7 authored by Jérome Perrin's avatar Jérome Perrin

core: drop text/comma-separated-values mime type

we use to have two entries for csv:

  - text/comma-separated-values
     - mimes: ["text/comma-separated-values"]
     - extensions: ["csv"]
     - globs: []
  - CSV document
     - mimes: ["text/csv", "text/x-comma-separated-values", "text/x-csv"]
     - extensions: []
     - globs: ["*.csv"]

but text/comma-separated-values does not really exist, rfc4180 recommends
text/csv.

The problem with this configuration is that when ERP5 picks a mime type
for csv extension, it uses text/comma-separated-values, as this one has
extensions set.

Change the configuration to delete "text/comma-separated-values" and keep
everything in "CSV document":

  - CSV document
     - mimes: ["text/csv", "text/x-comma-separated-values", "text/x-csv", "text/comma-separated-values"]
     - extensions: ["csv"]
     - globs: ["*.csv"]
parent 3b91fe33
......@@ -691,6 +691,19 @@ class TestDocument(TestDocumentMixin):
'attachment; filename="PDF.pdf"; filename*=UTF-8\'\'PDF%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB.pdf',
)
def test_csv(self):
doc = self.portal.document_module.newContent(
portal_type='Spreadsheet',
file=makeFileUpload('simple.csv'),
)
self.assertEqual(doc.getContentType(), 'text/csv')
doc.publish()
self.tic()
response = self.publish('%s?format=' % doc.getPath())
self.assertEqual(response.getBody(), makeFileUpload('simple.csv').read())
self.assertEqual(response.getHeader('Content-Type'), 'text/csv; charset=utf-8')
self.assertEqual(response.getHeader('Content-Disposition'), 'attachment; filename="simple.csv"')
def test_05_getCreationDate(self):
"""
Check getCreationDate on all document types.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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