feat: 导入文件名后缀大小写不敏感
This commit is contained in:
@@ -399,7 +399,7 @@ public class ImportUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 文件校验
|
||||
private boolean fileValid(String cellValue, Map<String, File> fileMap) {
|
||||
String[] pathList = cellValue.split(",");
|
||||
for (String path : pathList) {
|
||||
@@ -408,10 +408,12 @@ public class ImportUtil {
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(path.endsWith(".pdf")
|
||||
|| path.endsWith(".doc") || path.endsWith(".docx")
|
||||
|| path.endsWith(".xls") || path.endsWith(".xlsx")
|
||||
|| path.endsWith(".png") || path.endsWith(".jpg"))) {
|
||||
// 转换为小写以进行大小写不敏感的比较
|
||||
String lowerCasePath = path.toLowerCase();
|
||||
if (!(lowerCasePath.endsWith(".pdf")
|
||||
|| lowerCasePath.endsWith(".doc") || lowerCasePath.endsWith(".docx")
|
||||
|| lowerCasePath.endsWith(".xls") || lowerCasePath.endsWith(".xlsx")
|
||||
|| lowerCasePath.endsWith(".png") || lowerCasePath.endsWith(".jpg"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user