diff options
Diffstat (limited to 'src/helpers/types.js')
-rw-r--r-- | src/helpers/types.js | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/helpers/types.js b/src/helpers/types.js index 597f7c06..22ec61fb 100644 --- a/src/helpers/types.js +++ b/src/helpers/types.js @@ -21,23 +21,11 @@ * */ -const getFileType = (document, ooxml) => { - let documentTypes = { - document: { - extension: 'odt', - mime: 'application/vnd.oasis.opendocument.text' - }, - spreadsheet: { - extension: 'ods', - mime: 'application/vnd.oasis.opendocument.spreadsheet' - }, - presentation: { - extension: 'odp', - mime: 'application/vnd.oasis.opendocument.presentation' - } - } +const ooxml = OC.getCapabilities()['richdocuments']['config']['doc_format'] === 'ooxml' + +const getFileTypes = () => { if (ooxml) { - documentTypes = { + return { document: { extension: 'docx', mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' @@ -52,9 +40,27 @@ const getFileType = (document, ooxml) => { } } } - return documentTypes[document] + return { + document: { + extension: 'odt', + mime: 'application/vnd.oasis.opendocument.text' + }, + spreadsheet: { + extension: 'ods', + mime: 'application/vnd.oasis.opendocument.spreadsheet' + }, + presentation: { + extension: 'odp', + mime: 'application/vnd.oasis.opendocument.presentation' + } + } +} + +const getFileType = (document) => { + return getFileTypes()[document] } export default { + getFileTypes, getFileType } |