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