From 2bdedf7fe7ab8c83906dea4c0ca4955c6bb759ad Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 20 Jan 2025 13:15:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=B8=8A=E4=BC=A0=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualization/server/StaticResourceServer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/StaticResourceServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/StaticResourceServer.java index 3dfce540bb..12cfdd6984 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/StaticResourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/StaticResourceServer.java @@ -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];