diff --git a/packages/nc-gui-v2/pages/[projectType]/[projectId]/index/index/index.vue b/packages/nc-gui-v2/pages/[projectType]/[projectId]/index/index/index.vue index f84902cfbe..c28edbe275 100644 --- a/packages/nc-gui-v2/pages/[projectType]/[projectId]/index/index/index.vue +++ b/packages/nc-gui-v2/pages/[projectType]/[projectId]/index/index/index.vue @@ -20,13 +20,18 @@ type QuickImportTypes = 'excel' | 'json' | 'csv' const allowedQuickImportTypes = [ // Excel - '.xls, .xlsx, .xlsm, .ods, .ots', + 'application/vnd.ms-excel', // .xls + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx + 'application/vnd.ms-excel.sheet.macroenabled.12', // .xlsm + 'application/vnd.oasis.opendocument.spreadsheet', // .ods + 'application/vnd.oasis.opendocument.spreadsheet-template', // .ots // CSV - '.csv', + 'text/csv', // JSON - '.json', + 'application/json', + 'text/json', ] watch(files, (nextFiles) => nextFiles && onFileSelect(nextFiles), { flush: 'post' }) @@ -52,10 +57,11 @@ function onDrop(droppedFiles: File[] | null) { let fileType: QuickImportTypes | null = null const isValid = allowedQuickImportTypes.some((type) => { - const isAllowed = droppedFiles[0].type.replace('/', '.').endsWith(type) + const isAllowed = droppedFiles[0].type === type if (isAllowed) { - fileType = type.replace('.', '') as QuickImportTypes + const ext = droppedFiles[0].name.split('.').pop() + fileType = (ext === 'csv' || ext === 'json') ? ext : 'excel' as QuickImportTypes } return isAllowed