Adding vnd.ms-excel MIME type support in BulkImportWorkbookServiceImpl (#650)

This commit is contained in:
Maek Twain
2019-11-27 18:33:17 -08:00
committed by Michael Vorburger ⛑️
parent c6d8a49a8c
commit 981bc17a60
@@ -98,9 +98,12 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
final String fileType = tika.detect(tikaInputStream);
final String fileExtension = Files.getFileExtension(fileDetail.getFileName()).toLowerCase();
ImportFormatType format = ImportFormatType.of(fileExtension);
if (!fileType.contains("msoffice")) {
throw new GeneralPlatformDomainRuleException("error.msg.invalid.file.extension",
"Uploaded file extension is not recognized.");
if (!fileType.contains("msoffice") && !fileType.contains("application/vnd.ms-excel")) {
// We had a problem where we tried to upload the downloaded file from the import options, it was somehow changed the
// extension we use this fix.
throw new GeneralPlatformDomainRuleException("error.msg.invalid.file.extension",
"Uploaded file extension is not recognized.");
}
Workbook workbook = new HSSFWorkbook(clonedInputStreamWorkbook);
GlobalEntityType entityType=null;