fix:图片压缩添加文件校验
This commit is contained in:
@@ -44,6 +44,10 @@ public class ImageCompress {
|
|||||||
File file;
|
File file;
|
||||||
try {
|
try {
|
||||||
file = new File(path);
|
file = new File(path);
|
||||||
|
String suffix = FileUtil.getExtensionName(file.getName());
|
||||||
|
if (!"图片".equals(FileUtil.getFileType(suffix))) {
|
||||||
|
return file.length();
|
||||||
|
}
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
throw new BadRequestException("文件不存在");
|
throw new BadRequestException("文件不存在");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user