refactor: 优化图片上传错误提示

This commit is contained in:
wangjiahao 2025-01-20 13:15:41 +08:00 committed by 王嘉豪
parent 3419beb6f3
commit 2bdedf7fe7

View File

@ -143,9 +143,14 @@ public class StaticResourceServer implements StaticResourceApi {
}
} catch (ParserConfigurationException | SAXException | IOException e) {
// 如果出现任何解析错误说明该文件不是合法的SVG
return false;
if(e.getMessage() != null && e.getMessage().indexOf("DOCTYPE")>-1){
DEException.throwException("svg 内容禁止使用 DOCTYPE");
}else {
DEException.throwException(e);
}
}
return false;
}
public static FileType getFileType(InputStream is) throws IOException {
byte[] src = new byte[28];
is.read(src, 0, 28);