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