mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
refactor: 优化图片上传错误提示
This commit is contained in:
parent
3419beb6f3
commit
2bdedf7fe7
@ -118,7 +118,7 @@ public class StaticResourceServer implements StaticResourceApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isValidSVG(MultipartFile file) {
|
||||
private static boolean isValidSVG(MultipartFile file){
|
||||
if (file == null || file.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@ -143,8 +143,13 @@ 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];
|
||||
|
Loading…
Reference in New Issue
Block a user