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 fileType = tika.detect(tikaInputStream);
final String fileExtension = Files.getFileExtension(fileDetail.getFileName()).toLowerCase(); final String fileExtension = Files.getFileExtension(fileDetail.getFileName()).toLowerCase();
ImportFormatType format = ImportFormatType.of(fileExtension); ImportFormatType format = ImportFormatType.of(fileExtension);
if (!fileType.contains("msoffice")) { if (!fileType.contains("msoffice") && !fileType.contains("application/vnd.ms-excel")) {
throw new GeneralPlatformDomainRuleException("error.msg.invalid.file.extension", // We had a problem where we tried to upload the downloaded file from the import options, it was somehow changed the
"Uploaded file extension is not recognized."); // extension we use this fix.
throw new GeneralPlatformDomainRuleException("error.msg.invalid.file.extension",
"Uploaded file extension is not recognized.");
} }
Workbook workbook = new HSSFWorkbook(clonedInputStreamWorkbook); Workbook workbook = new HSSFWorkbook(clonedInputStreamWorkbook);
GlobalEntityType entityType=null; GlobalEntityType entityType=null;