Aggiunto controllo estensione in lettura file excel

This commit is contained in:
2024-02-15 10:04:38 +01:00
parent 3283f856ec
commit 2c41e6cbe7

View File

@@ -1,6 +1,7 @@
package it.integry.ems_model.utility;
import it.integry.ems.Import.dto.ImportRequestDTO;
import org.apache.commons.io.FilenameUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFCellUtil;
import org.apache.poi.openxml4j.opc.OPCPackage;
@@ -133,6 +134,9 @@ public class UtilityExcel {
if (UtilityString.isNullOrEmpty(fileName))
fileName = requestDTO.getFileName();
if (!FilenameUtils.getExtension(fileName).equalsIgnoreCase("xlsx"))
throw new Exception("Formato file non supportato");
if (!path.endsWith("\\") || !path.endsWith("/"))
path = path + File.separator;