From da466619b1a23ddd19c424a8f92a204498aae923 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Wed, 17 Feb 2021 04:45:21 +0300 Subject: [PATCH 1/4] feat: extend MIME type otpions --- src/qtiCommonRenderer/helpers/uploadMime.js | 481 +++++++++++++++++++- 1 file changed, 457 insertions(+), 24 deletions(-) diff --git a/src/qtiCommonRenderer/helpers/uploadMime.js b/src/qtiCommonRenderer/helpers/uploadMime.js index 6c568391..c804812a 100644 --- a/src/qtiCommonRenderer/helpers/uploadMime.js +++ b/src/qtiCommonRenderer/helpers/uploadMime.js @@ -26,64 +26,497 @@ var uploadMime = { */ getMimeTypes: function getMimeTypes() { return [ - { mime: 'application/zip', label: __('ZIP archive'), equivalent: ['application/x-zip-compressed'] }, - { mime: 'text/plain', label: __('Plain text') }, - { mime: 'application/pdf', label: __('PDF file') }, - { mime: 'image/jpeg', label: __('JPEG image') }, - { mime: 'image/png', label: __('PNG image') }, - { mime: 'image/gif', label: __('GIF image') }, - { mime: 'image/svg+xml', label: __('SVG image') }, - { mime: 'audio/mpeg', label: __('MPEG audio'), equivalent: ['audio/mp3'] }, - { mime: 'audio/x-ms-wma', label: __('Windows Media audio') }, - { mime: 'audio/x-wav', label: __('WAV audio'), equivalent: ['audio/wav'] }, - { mime: 'video/mpeg', label: __('MPEG video') }, - { mime: 'video/mp4', label: __('MP4 video') }, - { mime: 'video/quicktime', label: __('Quicktime video') }, - { mime: 'video/x-ms-wmv', label: __('Windows Media video') }, + { + mime: 'application/zip', + label: __('ZIP archive'), + equivalent: [ + 'application/x-compress', + 'application/x-compressed', + 'application/x-zip', + 'application/x-zip-compressed', + 'application/zip-compressed', + 'application/x-7zip-compressed', + ], + extensions: ['zip', 'zipx'] + }, + { + mime: 'text/plain', + label: __('Plain text'), + extensions: ['txt', 'bas'] + }, + { + mime: 'application/pdf', + label: __('PDF file'), + equivalent: [ + 'application/acrobat', + 'application/nappdf', + 'application/x-pdf', + 'application/vnd.pdf', + 'text/pdf', + 'text/x-pdf' + ], + extensions: ['pdf'] + }, + { + mime: 'image/jpeg', + label: __('JPEG image'), + equivalent: ['image/pjpeg'], + extensions: ['pjpeg', 'jfif', 'jpe', 'jpeg', 'jpg'] + }, + { + mime: 'image/png', + label: __('PNG image'), + equivalent: ['image/x-png'], + extensions: ['png'] + }, + { + mime: 'image/gif', + label: __('GIF image'), + extensions: ['gif'] + }, + { + mime: 'image/svg+xml', + label: __('SVG image'), + extensions: ['svg'] + }, + { + mime: 'audio/mpeg', + label: __('MPEG audio'), + equivalent: [ + 'audio/mp3', + 'audio/mpeg3', + 'audio/mpg', + 'audio/x-mp3', + 'audio/x-mpeg', + 'audio/x-mpeg3', + 'audio/x-mpg' + ], + extensions: ['mp3'] + }, + { + mime: 'audio/x-ms-wma', + label: __('Windows Media audio'), + extensions: ['wma'] + }, + { + mime: 'audio/x-wav', + label: __('WAV audio'), + equivalent: ['audio/wav', 'audio/s-wav', 'audio/wave'], + extensions: ['wav'] + }, + { + mime: 'video/mpeg', + label: __('MPEG video'), + extensions: ['m1v', 'm2v', 'mp2', 'mpa', 'mpe', 'mpeg', 'mpg', 'mpv2'] + }, + { + mime: 'video/mp4', + label: __('MP4 video'), + equivalent: ['video/mpeg4', 'video/x-m4v'], + extensions: ['m4v'] + }, + { + mime: 'video/quicktime', + label: __('Quicktime video'), + extensions: ['mov', 'qt', 'mqv'] + }, + { + mime: 'video/x-ms-wmv', + label: __('Windows Media video'), + extensions: ['wmv'] + }, { mime: 'video/x-flv', label: __('Flash video'), - equivalent: ['.flv'] + equivalent: ['.flv'], + extensions: ['flv'] }, { mime: 'text/csv', label: __('CSV file'), - equivalent: ['.csv'] + equivalent: ['.csv', 'application/csv', 'text/comma-separated-values', 'text/x-comma-separated-values'], + extensions: ['csv'] }, { - mime: 'application/msword', + mime: 'application/vnd.ms-word', label: __('Microsoft Word'), - equivalent: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'] + equivalent: [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'application/vnd.ms-word.document.macroEnabled.12', + 'application/vnd.ms-word.template.macroEnabled.12', + 'application/doc', + 'application/msword', + 'application/msword-doc', + 'application/vnd.msword', + 'application/winword', + 'application/word', + 'application/x-msw6', + 'application/x-msword', + 'application/x-msword-doc' + ], + extensions: ['doc', 'docx', 'dot', 'docm', 'dotm', 'dotx'] }, { mime: 'application/vnd.ms-excel', label: __('Microsoft Excel'), - equivalent: ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] + equivalent: [ + 'application/excel', + 'application/msexcel', + 'application/msexcell', + 'application/x-dos_ms_excel', + 'application/x-excel', + 'application/x-ms-excel', + 'application/x-msexcel', + 'application/x-xls', + 'application/xls', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'application/vnd.ms-excel.sheet.macroEnabled.12' + ], + extensions: ['xls', 'xlsx', 'xlsb', 'xlsm'] }, { mime: 'application/vnd.ms-powerpoint', label: __('Microsoft Powerpoint'), - equivalent: ['application/vnd.openxmlformats-officedocument.presentationml.presentation'] + equivalent: [ + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'application/ms-powerpoint', + 'application/mspowerpoint', + 'application/powerpoint', + 'application/ppt', + 'application/vnd-mspowerpoint', + 'application/vnd_ms-powerpoint', + 'application/x-mspowerpoint', + 'application/x-powerpoint' + ], + extensions: ['ppt', 'pptm', 'pptx', 'ppsm', 'ppsx'] }, { mime: 'application/vnd.oasis.opendocument.text', label: __('OpenDocument text document'), - equivalent: ['.odf'] + equivalent: ['.odf'], + extensions: ['odt'] }, { mime: 'application/vnd.oasis.opendocument.spreadsheet', label: __('OpenDocument spreadsheet document'), - equivalent: ['.ods'] + equivalent: ['.ods'], + extensions: ['ods'] }, { mime: 'text/x-c', label: __('C++ file (.cpp)'), - equivalent: ['.cpp'] + equivalent: ['.cpp', 'text/x-c++src'], + extensions: ['cpp', 'c++'] + }, + { + mime: 'text/x-csrc', + label: __('C file'), + equivalent: ['text/x-c'], + extensions: ['c'] }, { mime: 'text/pascal', label: __('Pascal file (.pas)'), - equivalent: ['.pas'] + equivalent: ['.pas'], + extensions: ['.pas'] + }, + { + mime: 'video/avi', + label: __('Audio Video Interleave'), + equivalent: [ + 'application/x-troff-msvideo', + 'image/avi', + 'video/msvideo', + 'video/x-msvideo', + 'video/xmpg2' + ], + extensions: ['avi'] + }, + { + mime: 'image/bmp', + label: __('Bitmap image'), + equivalent: [ + 'application/bmp', + 'application/x-bmp', + 'image/ms-bmp', + 'image/x-bitmap', + 'image/x-bmp', + 'image/x-ms-bmp', + 'image/x-win-bitmap', + 'image/x-windows-bmp', + 'image/x-xbitmap' + ], + extensions: ['bmp'] + }, + { + mime: 'text/css', + label: __('Cascading Style Sheets'), + equivalent: ['application/css-stylesheet'], + extensions: ['css'] + }, + { + mime: 'image/x-emf', + label: __('Enhanced metafile'), + extensions: ['emf'] + }, + { + mime: 'application/vnd.geogebra.file application-x/geogebra-file', + label: __('Geogebra data file'), + extensions: ['ggb'] + }, + { + mime: 'text/x-h', + label: __('Header file with extensions'), + extensions: ['h'] + }, + { + mime: 'application/hlp', + label: __('Windows help file'), + equivalent: ['application/x-helpfile', 'application/x-winhelp'], + extensions: ['hlp'] + }, + { + mime: 'text/html', + label: __('Hypertext markup language'), + extensions: ['htm', 'html'] + }, + { + mime: 'application/x-javascript', + label: __('Javascript code'), + equivalent: ['application/javascript', 'application/ecmascript', 'text/javascript', 'text/ecmascript'], + extensions: ['js'] + }, + { + mime: 'application/octet-stream', + label: __('Database file'), + extensions: ['mdb'] + }, + { + mime: 'image/vnd.ms-modi', + label: __('Microsoft Office Document Imaging'), + equivalent: [], + extensions: ['mdi'] + }, + { + mime: 'multipart/related', + label: __('MIME encapsulation of aggregate HTML documents'), + equivalent: ['message/rfc822', 'application/x-mimearchive'], + extensions: ['mht'] + }, + { + mime: 'application/base64', + label: __('Mind mapping software application (free mind open source)'), + equivalent: ['application/x-meme'], + extensions: ['mm'] + }, + { + mime: 'audio/m4a', + label: __('MPEG-4 audio file'), + equivalent: ['audio/x-m4a'], + extensions: ['m4a'] + }, + { + mime: 'video/x-sgi-movie', + label: __('Storing digital video data on a computer game'), + extensions: ['movie'] + }, + { + mime: 'application/vnd.ms-project', + label: __('Microsoft Project file'), + equivalent: [ + 'application/mpp', + 'application/msproj', + 'application/msproject', + 'application/x-dos_ms_project', + 'application/x-ms-project', + 'application/x-msproject' + ], + extensions: ['mpp'] + }, + { + mime: 'application/vnd.oasis.opendocument.database', + label: __('OpenDocument Database'), + extensions: ['odb'] + }, + { + mime: 'application/vnd.oasis.opendocument.presentation', + label: __('OpenDocument Presentation'), + extensions: ['odp'] + }, + { + mime: 'application/vnd.oasis.opendocument.spreadsheet', + label: __('OpenDocument Spreadsheet'), + extensions: ['ods'] + }, + { + mime: 'application/vnd.oasis.opendocument.text', + label: __('OpenDocument Text'), + extensions: ['odt'] + }, + { + mime: 'application/vnd.oasis.opendocument.text-template', + label: __('OpenDocument Text Template'), + extensions: ['ott'] + }, + { + mime: 'application/octet-stream', + label: __('Flowchart-based programming environment'), + extensions: ['rap'] + }, + { + mime: 'application/vnd.rn-realmedia', + label: __('RealMedia file'), + extensions: ['rm'] + }, + { + mime: 'application/rtf', + label: __('Rich Text Format file'), + equivalent: ['application/richtext', 'application/x-rtf', 'text/richtext', 'text/rtf'], + extensions: ['rtf'] + }, + { + mime: 'application/vnd.sun.xml.writer.template', + label: __('Document templates (Staroffice)'), + extensions: ['stw'] + }, + { + mime: 'application/x-shockwave-flash', + label: __('Adobe Flash file'), + equivalent: ['application/futuresplash'], + extensions: ['swf'] + }, + { + mime: 'application/x-sibelius-score', + label: __('Sibelius music notation'), + extensions: ['sib'] + }, + { + mime: 'application/tar', + label: __('Compressed tar file'), + equivalent: ['application/x-gtar', 'application/x-tar'], + extensions: ['tar'] + }, + { + mime: 'application/vnd.sun.xml.calc', + label: __('Calc speadsheet (Staroffice)'), + extensions: ['sxc'] + }, + { + mime: 'application/vnd.sun.xml.writer', + label: __('Text document file format (Staroffice)'), + extensions: ['sxw'] + }, + { + mime: 'application/x-tex', + label: __('TeX file'), + equivalent: ['text/x-tex'], + extensions: [''] + }, + { + mime: 'image/tiff', + label: __('Tagged image file'), + equivalent: [ + 'application/tif', + 'application/tiff', + 'application/x-tif', + 'application/x-tiff', + 'image/tif', + 'image/x-tif', + 'image/x-tiff' + ], + extensions: ['tif', 'tiff'] + }, + { + mime: 'application/vnd.visio', + label: __('Microsoft Visio file'), + equivalent: [ + 'application/visio', + 'application/visio.drawing', + 'application/vsd', + 'application/x-visio', + 'application/x-vsd', + 'image/x-vsd' + ], + extensions: ['vsd'] + }, + { + mime: 'application/vnd.ms-works', + label: __('Microsoft Works file (spreadsheet)'), + equivalent: ['application/x-msworks-wp'], + extensions: ['wks'] + }, + { + mime: 'image/x-wmf', + label: __('Windows Media file (metafile)'), + equivalent: [ + 'application/wmf', + 'application/x-msmetafile', + 'application/x-wmf', + 'image/wmf', + 'image/x-win-metafile' + ], + extensions: ['wmf'] + }, + { + mime: 'application/vnd.ms-works', + label: __('Microsoft Works file (processor file)'), + equivalent: ['application/x-msworks-wp'], + extensions: ['wps'] + }, + { + mime: 'application/x-mswrite', + label: __('Write Document'), + extensions: ['wri'] + }, + { + mime: 'text/xml', + label: __('XML file'), + equivalent: ['application/x-xml', 'application/xml'], + extensions: ['xml'] + }, + { + mime: 'application/vnd.ms-xpsdocument', + label: __('Microsoft XPS file'), + extensions: ['xps'] + }, + { + mime: 'application/x-7z-compressed', + label: __('7-zip archive'), + extensions: ['7z'] + }, + { + mime: 'application/gzip', + label: __('GZip Compressed Archive'), + equivalent: [ + 'application/gzip-compressed', + 'application/gzipped', + 'application/x-gunzip', + 'application/x-gzip' + ], + extensions: ['gz'] + }, + { + mime: 'application/vnd.rar', + label: __('RAR archive'), + equivalent: ['application/rar', 'application/x-rar-compressed'], + extensions: ['rar'] + }, + { + mime: 'application/tar', + label: __('Tape Archive (TAR)'), + equivalent: ['application/x-gtar', 'application/x-tar'], + extensions: ['tar'] + }, + { + mime: 'application/x-compress', + label: __('UNIX Compressed Archive File'), + equivalent: ['application/z', 'application/x-z'], + extensions: ['z'] } ]; }, From a51a9a497ac49139a822d29fe0bd99845ab5319a Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Wed, 17 Feb 2021 04:50:08 +0300 Subject: [PATCH 2/4] chore: bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99d1a840..024b01d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@oat-sa/tao-item-runner-qti", - "version": "0.18.0", + "version": "0.19.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@oat-sa/tao-item-runner-qti", - "version": "0.18.0", + "version": "0.19.0", "license": "GPL-2.0", "devDependencies": { "@oat-sa/browserslist-config-tao": "^0.1.0", diff --git a/package.json b/package.json index 84e29f3f..8b529348 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oat-sa/tao-item-runner-qti", - "version": "0.18.0", + "version": "0.19.0", "displayName": "TAO Item Runner QTI", "description": "TAO QTI Item Runner modules", "files": [ From f5542cdf4681d7b89305286cfc02dd6d032cc3f8 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Fri, 19 Feb 2021 01:12:51 +0000 Subject: [PATCH 3/4] fix: change MIME-type equivalents to the correct values --- .../helpers/data/mimeTypes.js | 349 ++++++++++++ src/qtiCommonRenderer/helpers/uploadMime.js | 496 +----------------- 2 files changed, 351 insertions(+), 494 deletions(-) create mode 100644 src/qtiCommonRenderer/helpers/data/mimeTypes.js diff --git a/src/qtiCommonRenderer/helpers/data/mimeTypes.js b/src/qtiCommonRenderer/helpers/data/mimeTypes.js new file mode 100644 index 00000000..3217cca2 --- /dev/null +++ b/src/qtiCommonRenderer/helpers/data/mimeTypes.js @@ -0,0 +1,349 @@ +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2021 (original work) Open Assessment Technologies SA; + */ + +import __ from 'i18n'; + +export default { + getList: function getList() { + return [ + { + mime: 'application/zip', + label: __('ZIP archive'), + equivalent: ['.zipx'] + }, + { + mime: 'text/plain', + label: __('Plain text') + }, + { + mime: 'application/pdf', + label: __('PDF file') + }, + { + mime: 'image/jpeg', + label: __('JPEG image'), + equivalent: ['.jpe'] + }, + { + mime: 'image/png', + label: __('PNG image') + }, + { + mime: 'image/gif', + label: __('GIF image') + }, + { + mime: 'image/svg+xml', + label: __('SVG image') + }, + { + mime: 'audio/mpeg', + label: __('MPEG audio') + }, + { + mime: 'audio/x-ms-wma', + label: __('Windows Media audio') + }, + { + mime: 'audio/x-wav', + label: __('WAV audio') + }, + { + mime: 'video/mpeg', + label: __('MPEG video') + }, + { + mime: 'video/mp4', + label: __('MP4 video') + }, + { + mime: 'video/quicktime', + label: __('Quicktime video'), + equivalent: ['.qt'] + }, + { + mime: 'video/x-ms-wmv', + label: __('Windows Media video') + }, + { + mime: 'video/x-flv', + label: __('Flash video'), + equivalent: ['.flv'] + }, + { + mime: 'text/csv', + label: __('CSV file'), + equivalent: ['.csv'] + }, + { + mime: 'application/msword', + label: __('Microsoft Word'), + equivalent: [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.ms-word.document.macroEnabled.12', + 'application/vnd.ms-word.template.macroEnabled.12', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + '.doc', + '.docx', + '.dot', + '.docm', + '.dotm', + '.dotx' + ] + }, + { + mime: 'application/vnd.ms-excel', + label: __('Microsoft Excel'), + equivalent: [ + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'application/vnd.ms-excel.sheet.macroEnabled.12', + '.xlsb', + '.xlsm' + ] + }, + { + mime: 'application/vnd.ms-powerpoint', + label: __('Microsoft Powerpoint'), + equivalent: [ + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + '.ppt', + '.pptm', + '.pptx', + '.ppsm', + '.ppsx' + ] + }, + { + mime: 'application/vnd.oasis.opendocument.text', + label: __('OpenDocument text document'), + equivalent: ['.odt'] + }, + { + mime: 'application/vnd.oasis.opendocument.spreadsheet', + label: __('OpenDocument spreadsheet document'), + equivalent: ['.ods'] + }, + { + mime: 'text/x-c', + label: __('C++ file (.cpp)'), + equivalent: ['.cpp'] + }, + { + mime: 'text/x-csrc', + label: __('C file'), + equivalent: ['text/plain', '.c'] + }, + { + mime: 'text/pascal', + label: __('Pascal file (.pas)'), + equivalent: ['.pas'] + }, + { + mime: 'video/avi', + label: __('Audio Video Interleave') + }, + { + mime: 'image/bmp', + label: __('Bitmap image') + }, + { + mime: 'text/css', + label: __('Cascading Style Sheets') + }, + { + mime: 'image/x-emf', + label: __('Enhanced metafile') + }, + { + mime: 'application/vnd.geogebra.file', + label: __('Geogebra data file') + }, + { + mime: 'text/x-h', + label: __('Header file with extensions'), + equivalent: ['text/plain', '.h'] + }, + { + mime: 'application/winhlp', + label: __('Windows help file'), + equivalent: ['.hlp'] + }, + { + mime: 'text/html', + label: __('Hypertext markup language') + }, + { + mime: 'application/x-javascript', + label: __('Javascript code') + }, + { + mime: 'application/vnd.ms-access', + label: __('Database file'), + equivalent: ['.mdb'] + }, + { + mime: 'image/vnd.ms-modi', + label: __('Microsoft Office Document Imaging'), + equivalent: ['.mdi'] + }, + { + mime: 'multipart/related', + label: __('MIME encapsulation of aggregate HTML documents') + }, + { + mime: 'application/base64', + label: __('Mind mapping software application (free mind open source)'), + equivalent: ['.mm'] + }, + { + mime: 'audio/m4a', + label: __('MPEG-4 audio file') + }, + { + mime: 'video/x-sgi-movie', + label: __('Storing digital video data on a computer game'), + equivalent: ['.movie'] + }, + { + mime: 'application/vnd.ms-project', + label: __('Microsoft Project file'), + equivalent: ['.mpp'] + }, + { + mime: 'application/vnd.oasis.opendocument.database', + label: __('OpenDocument Database'), + equivalent: ['.odb'] + }, + { + mime: 'application/vnd.oasis.opendocument.presentation', + label: __('OpenDocument Presentation'), + equivalent: ['.odp'] + }, + { + mime: 'application/vnd.oasis.opendocument.text-template', + label: __('OpenDocument Text Template'), + equivalent: ['.ott'] + }, + { + mime: 'application/octet-stream', + label: __('Flowchart-based programming environment'), + equivalent: ['.rap'] + }, + { + mime: 'application/vnd.rn-realmedia', + label: __('RealMedia file'), + equivalent: ['.rm'] + }, + { + mime: 'application/rtf', + label: __('Rich Text Format file'), + equivalent: ['.rtf'] + }, + { + mime: 'application/vnd.sun.xml.writer.template', + label: __('Document templates (Staroffice)'), + equivalent: ['.stw'] + }, + { + mime: 'application/x-shockwave-flash', + label: __('Adobe Flash file') + }, + { + mime: 'application/x-sibelius-score', + label: __('Sibelius music notation'), + equivalent: ['.sib'] + }, + { + mime: 'application/x-tar', + label: __('Compressed tar file') + }, + { + mime: 'application/vnd.sun.xml.calc', + label: __('Calc speadsheet (Staroffice)'), + equivalent: ['.sxc'] + }, + { + mime: 'application/vnd.sun.xml.writer', + label: __('Text document file format (Staroffice)'), + equivalent: ['.sxw'] + }, + { + mime: 'application/x-tex', + label: __('TeX file'), + equivalent: ['.tex'] + }, + { + mime: 'image/tiff', + label: __('Tagged image file') + }, + { + mime: 'application/vnd.visio', + label: __('Microsoft Visio file'), + equivalent: ['.vsd'] + }, + { + mime: 'application/vnd.ms-works', + label: __('Microsoft Works file'), + equivalent: ['.wks', '.wps'] + }, + { + mime: 'image/x-wmf', + label: __('Windows Media file (metafile)') + }, + { + mime: 'application/x-mswrite', + label: __('Write Document'), + equivalent: ['.wri'] + }, + { + mime: 'text/xml', + label: __('XML file') + }, + { + mime: 'application/vnd.ms-xpsdocument', + label: __('Microsoft XPS file') + }, + { + mime: 'application/x-7z-compressed', + label: __('7-zip archive'), + equivalent: ['.7z'] + }, + { + mime: 'application/gzip', + label: __('GZip Compressed Archive') + }, + { + mime: 'application/x-rar-compressed', + label: __('RAR archive'), + equivalent: ['.rar'] + }, + { + mime: 'application/x-tar', + label: __('Tape Archive (TAR)') + }, + { + mime: 'application/x-compress', + label: __('UNIX Compressed Archive File') + } + ]; + } +}; diff --git a/src/qtiCommonRenderer/helpers/uploadMime.js b/src/qtiCommonRenderer/helpers/uploadMime.js index c804812a..614428bd 100644 --- a/src/qtiCommonRenderer/helpers/uploadMime.js +++ b/src/qtiCommonRenderer/helpers/uploadMime.js @@ -17,6 +17,7 @@ */ import _ from 'lodash'; import __ from 'i18n'; +import mimeTypes from './data/mimeTypes'; var uploadMime = { /** @@ -25,500 +26,7 @@ var uploadMime = { * @type [{getMimeTypes: getMimeTypes}] */ getMimeTypes: function getMimeTypes() { - return [ - { - mime: 'application/zip', - label: __('ZIP archive'), - equivalent: [ - 'application/x-compress', - 'application/x-compressed', - 'application/x-zip', - 'application/x-zip-compressed', - 'application/zip-compressed', - 'application/x-7zip-compressed', - ], - extensions: ['zip', 'zipx'] - }, - { - mime: 'text/plain', - label: __('Plain text'), - extensions: ['txt', 'bas'] - }, - { - mime: 'application/pdf', - label: __('PDF file'), - equivalent: [ - 'application/acrobat', - 'application/nappdf', - 'application/x-pdf', - 'application/vnd.pdf', - 'text/pdf', - 'text/x-pdf' - ], - extensions: ['pdf'] - }, - { - mime: 'image/jpeg', - label: __('JPEG image'), - equivalent: ['image/pjpeg'], - extensions: ['pjpeg', 'jfif', 'jpe', 'jpeg', 'jpg'] - }, - { - mime: 'image/png', - label: __('PNG image'), - equivalent: ['image/x-png'], - extensions: ['png'] - }, - { - mime: 'image/gif', - label: __('GIF image'), - extensions: ['gif'] - }, - { - mime: 'image/svg+xml', - label: __('SVG image'), - extensions: ['svg'] - }, - { - mime: 'audio/mpeg', - label: __('MPEG audio'), - equivalent: [ - 'audio/mp3', - 'audio/mpeg3', - 'audio/mpg', - 'audio/x-mp3', - 'audio/x-mpeg', - 'audio/x-mpeg3', - 'audio/x-mpg' - ], - extensions: ['mp3'] - }, - { - mime: 'audio/x-ms-wma', - label: __('Windows Media audio'), - extensions: ['wma'] - }, - { - mime: 'audio/x-wav', - label: __('WAV audio'), - equivalent: ['audio/wav', 'audio/s-wav', 'audio/wave'], - extensions: ['wav'] - }, - { - mime: 'video/mpeg', - label: __('MPEG video'), - extensions: ['m1v', 'm2v', 'mp2', 'mpa', 'mpe', 'mpeg', 'mpg', 'mpv2'] - }, - { - mime: 'video/mp4', - label: __('MP4 video'), - equivalent: ['video/mpeg4', 'video/x-m4v'], - extensions: ['m4v'] - }, - { - mime: 'video/quicktime', - label: __('Quicktime video'), - extensions: ['mov', 'qt', 'mqv'] - }, - { - mime: 'video/x-ms-wmv', - label: __('Windows Media video'), - extensions: ['wmv'] - }, - { - mime: 'video/x-flv', - label: __('Flash video'), - equivalent: ['.flv'], - extensions: ['flv'] - }, - { - mime: 'text/csv', - label: __('CSV file'), - equivalent: ['.csv', 'application/csv', 'text/comma-separated-values', 'text/x-comma-separated-values'], - extensions: ['csv'] - }, - { - mime: 'application/vnd.ms-word', - label: __('Microsoft Word'), - equivalent: [ - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'application/vnd.ms-word.document.macroEnabled.12', - 'application/vnd.ms-word.template.macroEnabled.12', - 'application/doc', - 'application/msword', - 'application/msword-doc', - 'application/vnd.msword', - 'application/winword', - 'application/word', - 'application/x-msw6', - 'application/x-msword', - 'application/x-msword-doc' - ], - extensions: ['doc', 'docx', 'dot', 'docm', 'dotm', 'dotx'] - }, - { - mime: 'application/vnd.ms-excel', - label: __('Microsoft Excel'), - equivalent: [ - 'application/excel', - 'application/msexcel', - 'application/msexcell', - 'application/x-dos_ms_excel', - 'application/x-excel', - 'application/x-ms-excel', - 'application/x-msexcel', - 'application/x-xls', - 'application/xls', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'application/vnd.ms-excel.sheet.macroEnabled.12' - ], - extensions: ['xls', 'xlsx', 'xlsb', 'xlsm'] - }, - { - mime: 'application/vnd.ms-powerpoint', - label: __('Microsoft Powerpoint'), - equivalent: [ - 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'application/ms-powerpoint', - 'application/mspowerpoint', - 'application/powerpoint', - 'application/ppt', - 'application/vnd-mspowerpoint', - 'application/vnd_ms-powerpoint', - 'application/x-mspowerpoint', - 'application/x-powerpoint' - ], - extensions: ['ppt', 'pptm', 'pptx', 'ppsm', 'ppsx'] - }, - { - mime: 'application/vnd.oasis.opendocument.text', - label: __('OpenDocument text document'), - equivalent: ['.odf'], - extensions: ['odt'] - }, - { - mime: 'application/vnd.oasis.opendocument.spreadsheet', - label: __('OpenDocument spreadsheet document'), - equivalent: ['.ods'], - extensions: ['ods'] - }, - { - mime: 'text/x-c', - label: __('C++ file (.cpp)'), - equivalent: ['.cpp', 'text/x-c++src'], - extensions: ['cpp', 'c++'] - }, - { - mime: 'text/x-csrc', - label: __('C file'), - equivalent: ['text/x-c'], - extensions: ['c'] - }, - { - mime: 'text/pascal', - label: __('Pascal file (.pas)'), - equivalent: ['.pas'], - extensions: ['.pas'] - }, - { - mime: 'video/avi', - label: __('Audio Video Interleave'), - equivalent: [ - 'application/x-troff-msvideo', - 'image/avi', - 'video/msvideo', - 'video/x-msvideo', - 'video/xmpg2' - ], - extensions: ['avi'] - }, - { - mime: 'image/bmp', - label: __('Bitmap image'), - equivalent: [ - 'application/bmp', - 'application/x-bmp', - 'image/ms-bmp', - 'image/x-bitmap', - 'image/x-bmp', - 'image/x-ms-bmp', - 'image/x-win-bitmap', - 'image/x-windows-bmp', - 'image/x-xbitmap' - ], - extensions: ['bmp'] - }, - { - mime: 'text/css', - label: __('Cascading Style Sheets'), - equivalent: ['application/css-stylesheet'], - extensions: ['css'] - }, - { - mime: 'image/x-emf', - label: __('Enhanced metafile'), - extensions: ['emf'] - }, - { - mime: 'application/vnd.geogebra.file application-x/geogebra-file', - label: __('Geogebra data file'), - extensions: ['ggb'] - }, - { - mime: 'text/x-h', - label: __('Header file with extensions'), - extensions: ['h'] - }, - { - mime: 'application/hlp', - label: __('Windows help file'), - equivalent: ['application/x-helpfile', 'application/x-winhelp'], - extensions: ['hlp'] - }, - { - mime: 'text/html', - label: __('Hypertext markup language'), - extensions: ['htm', 'html'] - }, - { - mime: 'application/x-javascript', - label: __('Javascript code'), - equivalent: ['application/javascript', 'application/ecmascript', 'text/javascript', 'text/ecmascript'], - extensions: ['js'] - }, - { - mime: 'application/octet-stream', - label: __('Database file'), - extensions: ['mdb'] - }, - { - mime: 'image/vnd.ms-modi', - label: __('Microsoft Office Document Imaging'), - equivalent: [], - extensions: ['mdi'] - }, - { - mime: 'multipart/related', - label: __('MIME encapsulation of aggregate HTML documents'), - equivalent: ['message/rfc822', 'application/x-mimearchive'], - extensions: ['mht'] - }, - { - mime: 'application/base64', - label: __('Mind mapping software application (free mind open source)'), - equivalent: ['application/x-meme'], - extensions: ['mm'] - }, - { - mime: 'audio/m4a', - label: __('MPEG-4 audio file'), - equivalent: ['audio/x-m4a'], - extensions: ['m4a'] - }, - { - mime: 'video/x-sgi-movie', - label: __('Storing digital video data on a computer game'), - extensions: ['movie'] - }, - { - mime: 'application/vnd.ms-project', - label: __('Microsoft Project file'), - equivalent: [ - 'application/mpp', - 'application/msproj', - 'application/msproject', - 'application/x-dos_ms_project', - 'application/x-ms-project', - 'application/x-msproject' - ], - extensions: ['mpp'] - }, - { - mime: 'application/vnd.oasis.opendocument.database', - label: __('OpenDocument Database'), - extensions: ['odb'] - }, - { - mime: 'application/vnd.oasis.opendocument.presentation', - label: __('OpenDocument Presentation'), - extensions: ['odp'] - }, - { - mime: 'application/vnd.oasis.opendocument.spreadsheet', - label: __('OpenDocument Spreadsheet'), - extensions: ['ods'] - }, - { - mime: 'application/vnd.oasis.opendocument.text', - label: __('OpenDocument Text'), - extensions: ['odt'] - }, - { - mime: 'application/vnd.oasis.opendocument.text-template', - label: __('OpenDocument Text Template'), - extensions: ['ott'] - }, - { - mime: 'application/octet-stream', - label: __('Flowchart-based programming environment'), - extensions: ['rap'] - }, - { - mime: 'application/vnd.rn-realmedia', - label: __('RealMedia file'), - extensions: ['rm'] - }, - { - mime: 'application/rtf', - label: __('Rich Text Format file'), - equivalent: ['application/richtext', 'application/x-rtf', 'text/richtext', 'text/rtf'], - extensions: ['rtf'] - }, - { - mime: 'application/vnd.sun.xml.writer.template', - label: __('Document templates (Staroffice)'), - extensions: ['stw'] - }, - { - mime: 'application/x-shockwave-flash', - label: __('Adobe Flash file'), - equivalent: ['application/futuresplash'], - extensions: ['swf'] - }, - { - mime: 'application/x-sibelius-score', - label: __('Sibelius music notation'), - extensions: ['sib'] - }, - { - mime: 'application/tar', - label: __('Compressed tar file'), - equivalent: ['application/x-gtar', 'application/x-tar'], - extensions: ['tar'] - }, - { - mime: 'application/vnd.sun.xml.calc', - label: __('Calc speadsheet (Staroffice)'), - extensions: ['sxc'] - }, - { - mime: 'application/vnd.sun.xml.writer', - label: __('Text document file format (Staroffice)'), - extensions: ['sxw'] - }, - { - mime: 'application/x-tex', - label: __('TeX file'), - equivalent: ['text/x-tex'], - extensions: [''] - }, - { - mime: 'image/tiff', - label: __('Tagged image file'), - equivalent: [ - 'application/tif', - 'application/tiff', - 'application/x-tif', - 'application/x-tiff', - 'image/tif', - 'image/x-tif', - 'image/x-tiff' - ], - extensions: ['tif', 'tiff'] - }, - { - mime: 'application/vnd.visio', - label: __('Microsoft Visio file'), - equivalent: [ - 'application/visio', - 'application/visio.drawing', - 'application/vsd', - 'application/x-visio', - 'application/x-vsd', - 'image/x-vsd' - ], - extensions: ['vsd'] - }, - { - mime: 'application/vnd.ms-works', - label: __('Microsoft Works file (spreadsheet)'), - equivalent: ['application/x-msworks-wp'], - extensions: ['wks'] - }, - { - mime: 'image/x-wmf', - label: __('Windows Media file (metafile)'), - equivalent: [ - 'application/wmf', - 'application/x-msmetafile', - 'application/x-wmf', - 'image/wmf', - 'image/x-win-metafile' - ], - extensions: ['wmf'] - }, - { - mime: 'application/vnd.ms-works', - label: __('Microsoft Works file (processor file)'), - equivalent: ['application/x-msworks-wp'], - extensions: ['wps'] - }, - { - mime: 'application/x-mswrite', - label: __('Write Document'), - extensions: ['wri'] - }, - { - mime: 'text/xml', - label: __('XML file'), - equivalent: ['application/x-xml', 'application/xml'], - extensions: ['xml'] - }, - { - mime: 'application/vnd.ms-xpsdocument', - label: __('Microsoft XPS file'), - extensions: ['xps'] - }, - { - mime: 'application/x-7z-compressed', - label: __('7-zip archive'), - extensions: ['7z'] - }, - { - mime: 'application/gzip', - label: __('GZip Compressed Archive'), - equivalent: [ - 'application/gzip-compressed', - 'application/gzipped', - 'application/x-gunzip', - 'application/x-gzip' - ], - extensions: ['gz'] - }, - { - mime: 'application/vnd.rar', - label: __('RAR archive'), - equivalent: ['application/rar', 'application/x-rar-compressed'], - extensions: ['rar'] - }, - { - mime: 'application/tar', - label: __('Tape Archive (TAR)'), - equivalent: ['application/x-gtar', 'application/x-tar'], - extensions: ['tar'] - }, - { - mime: 'application/x-compress', - label: __('UNIX Compressed Archive File'), - equivalent: ['application/z', 'application/x-z'], - extensions: ['z'] - } - ]; + return mimeTypes.getList(); }, /** From 0a595421783e6112e2cc2a3485495bab10608c94 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Mon, 22 Feb 2021 08:52:40 +0000 Subject: [PATCH 4/4] chore: bump tao-core-sdk version --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 024b01d8..15e3f61a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@oat-sa/expr-eval": "1.3.0", "@oat-sa/rollup-plugin-wildcard-external": "^0.1.0", "@oat-sa/tao-core-libs": "^0.4.3", - "@oat-sa/tao-core-sdk": "^1.8.1", + "@oat-sa/tao-core-sdk": "^1.9.0", "@oat-sa/tao-core-shared-libs": "^0.1.0", "@oat-sa/tao-core-ui": "^1.22.1", "@oat-sa/tao-item-runner": "^0.3.1", @@ -227,9 +227,9 @@ "dev": true }, "node_modules/@oat-sa/tao-core-sdk": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@oat-sa/tao-core-sdk/-/tao-core-sdk-1.8.1.tgz", - "integrity": "sha512-SlfRorpBkNJPRN3S9wDTk5dPdfaCmEEr4gSvM1XaQYghJlYjsKrDFu63p4jfqwO8JHk9zSHWFg605de8DBRRCw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@oat-sa/tao-core-sdk/-/tao-core-sdk-1.9.0.tgz", + "integrity": "sha512-HBdJ90O5u6IfMf+rw/Hlrv+RF5Zlcx7GEOVK8f2CSjJ9Sy6NAE6ueKx4jV+c9/HZO2yVR+TnTqeGOvKSQh9gRQ==", "dev": true, "dependencies": { "fastestsmallesttextencoderdecoder": "1.0.14", @@ -4708,9 +4708,9 @@ "dev": true }, "@oat-sa/tao-core-sdk": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@oat-sa/tao-core-sdk/-/tao-core-sdk-1.8.1.tgz", - "integrity": "sha512-SlfRorpBkNJPRN3S9wDTk5dPdfaCmEEr4gSvM1XaQYghJlYjsKrDFu63p4jfqwO8JHk9zSHWFg605de8DBRRCw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@oat-sa/tao-core-sdk/-/tao-core-sdk-1.9.0.tgz", + "integrity": "sha512-HBdJ90O5u6IfMf+rw/Hlrv+RF5Zlcx7GEOVK8f2CSjJ9Sy6NAE6ueKx4jV+c9/HZO2yVR+TnTqeGOvKSQh9gRQ==", "dev": true, "requires": { "fastestsmallesttextencoderdecoder": "1.0.14", diff --git a/package.json b/package.json index 8b529348..4be81441 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@oat-sa/expr-eval": "1.3.0", "@oat-sa/rollup-plugin-wildcard-external": "^0.1.0", "@oat-sa/tao-core-libs": "^0.4.3", - "@oat-sa/tao-core-sdk": "^1.8.1", + "@oat-sa/tao-core-sdk": "^1.9.0", "@oat-sa/tao-core-shared-libs": "^0.1.0", "@oat-sa/tao-core-ui": "^1.22.1", "@oat-sa/tao-item-runner": "^0.3.1",