MadeBaruna/paimon-moe

BUG: Unsupported MIME types for valid spreadsheet files

Opened this issue · 0 comments

function checkFile(file) {
console.log(file.type);
if (
file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
file.type === 'application/wps-office.xlsx'
) {
readExcel(file);
} else if (
file.type === 'text/csv' ||
file.type === 'application/vnd.ms-excel' ||
file.type === 'text/comma-separated-values'
) {
readCSV(file);
} else {
pushToast($t('wish.excel.errorInvalidFile') + ` [${file.type}]`, 'error');
}
}

The following MIME types are valid for excel

application/haansoftxlsx
application/kset
application/vnd.ms-excel.12
 x-softmaker-pm

The rest of these are unclear whether they should be handled as CSV or XLSX, but are valid:

application/excel
application/x-excel
application/x-msexcel
application/docxconverter

Sources:

  1. https://www.pcmatic.com/company/libraries/fileextension/detail.asp?ext=xlsx.html
  2. https://stackblitz.com/edit/test-mime-type?file=src%2Fapp%2Fapp.component.ts