fix:图片压缩添加文件校验

This commit is contained in:
zhangzhiqiang
2022-11-18 17:22:56 +08:00
parent 106e435e58
commit ad0a77c821

View File

@@ -44,6 +44,10 @@ public class ImageCompress {
File file;
try {
file = new File(path);
String suffix = FileUtil.getExtensionName(file.getName());
if (!"图片".equals(FileUtil.getFileType(suffix))) {
return file.length();
}
}catch (Exception ex){
throw new BadRequestException("文件不存在");
}