Commit 26a0394f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

ooo: update mime mapper and tests for LibreOffice 7.6.

parent 25361606
......@@ -94,7 +94,7 @@ class MimeMapper:
'Microsoft PowerPoint 2007-2013 XML':'ms.pptx',
'Microsoft Word 2007 XML':'ms.docx',
'Microsoft Word 2007-2013 XML':'ms.docx',
'Word 2007–365':'ms.docx',
'Word 2007':'ms.docx',
'Microsoft Word 6.0':'6.doc',
'Microsoft Word 95':'95.doc',
'TIFF - Tagged Image File Format': 'tiff',
......
......@@ -204,11 +204,11 @@ class TestHandler(HandlerTestCase):
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('image/webp', 'WEBP - WebP Image'),
......@@ -227,11 +227,11 @@ class TestHandler(HandlerTestCase):
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('image/webp', 'WEBP - WebP Image'),
......@@ -277,11 +277,11 @@ class TestHandler(HandlerTestCase):
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('image/webp', 'WEBP - WebP Image'),
......@@ -297,11 +297,11 @@ class TestHandler(HandlerTestCase):
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('image/webp', 'WEBP - WebP Image'),
......@@ -360,7 +360,7 @@ class TestHandler(HandlerTestCase):
('application/rtf', 'Rich Text'),
('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
......@@ -368,8 +368,8 @@ class TestHandler(HandlerTestCase):
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('application/vnd.sun.xml.writer', 'OpenOffice.org 1.0 Text Document (Writer/Web)'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
......@@ -688,11 +688,11 @@ class TestHandler(HandlerTestCase):
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('image/webp', 'WEBP - WebP Image'),
......@@ -709,7 +709,7 @@ class TestHandler(HandlerTestCase):
('application/rtf', 'Rich Text'),
('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007 VBA'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
......@@ -717,8 +717,8 @@ class TestHandler(HandlerTestCase):
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2010–365 Document'),
('application/vnd.sun.xml.writer', 'OpenOffice.org 1.0 Text Document (Writer/Web)'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
......
......@@ -36,12 +36,12 @@ from cloudooo.handler.ooo.mimemapper import MimeMapper
# extension/document_type, the returned mime types are different for text
text_expected_tuple = (
('doc', 'Word 97–2003'),
('docx', 'Office Open XML Text (Transitional)'),
('docx', 'Word 2010–365 Document'),
('epub', 'EPUB Document'),
('fodt', 'Flat XML ODF Text Document'),
('html', 'HTML Document (Writer)'),
('jpg', 'JPEG - Joint Photographic Experts Group'),
('ms.docx', 'Word 2007–365'),
('ms.docx', 'Word 2007'),
('odt', 'ODF Text Document'),
('pdf', 'PDF - Portable Document Format'),
('png', 'PNG - Portable Network Graphics'),
......@@ -50,7 +50,7 @@ text_expected_tuple = (
('webp', 'WEBP - WebP Image'),
)
extra_text_expected_tuple = (
('docm', 'Word 2007–365 VBA'),
('docm', 'Word 2007 VBA'),
)
global_expected_tuple = (
......
......@@ -52,7 +52,7 @@ class TestAllowedExtensions(TestCase):
text_allowed_list = self.proxy.getAllowedExtensionList(text_request)
# XXX slightly different allowed formats with document_type !?
_text_expected_tuple = text_expected_tuple + (
('docm', 'Word 2007–365 VBA'),
('docm', 'Word 2007 VBA'),
)
self.assertEqual(
sorted([tuple(x) for x in text_allowed_list]),
......
......@@ -84,7 +84,7 @@ def BBB_guess_extension(mimetype, title=None):
"Microsoft PowerPoint 2007-2013 XML": ".ms.pptx",
"Microsoft PowerPoint 2007-2013 XML AutoPlay": ".ms.ppsx",
"Microsoft Word 2007-2013 XML": ".ms.docx",
"Word 2007–365": ".ms.docx",
"Word 2007": ".ms.docx",
}.get(title, None) or {
# mediatype : extension
"application/msword": ".doc",
......
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