From 826513053146721a2b3e09a9c9d3ea41f8f10569 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 13 Sep 2023 18:20:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=A0=E5=BC=BA=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=8C=E9=98=B2=E6=AD=A2=E6=81=B6=E6=84=8F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=80=9A=E8=BF=87=E5=90=88=E6=88=90=E5=88=B0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E5=88=B0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=AD=E5=BC=95=E8=B5=B7=E7=9A=84=E6=94=BB=E5=87=BB?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/staticResource/StaticResourceService.java | 7 ++++++- core/frontend/src/views/background/BackgroundOverall.vue | 2 +- .../src/views/panel/appTemplate/AppTemplateContent.vue | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java b/core/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java index 19a8c5a04d..4353e96783 100644 --- a/core/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java +++ b/core/backend/src/main/java/io/dataease/service/staticResource/StaticResourceService.java @@ -24,6 +24,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Author: wangjiahao @@ -65,9 +67,12 @@ public class StaticResourceService { LogUtil.error(e.getMessage(), e); return false; } - if (image == null || image.getWidth() <= 0 || image.getHeight() <= 0) { + Pattern pattern = Pattern.compile("\\.(png|jpg|jpeg|gif)$"); + Matcher matcher = pattern.matcher(file.getOriginalFilename().toLowerCase()); + if (image == null || image.getWidth() <= 0 || image.getHeight() <= 0 || !matcher.find()) { return false; } + return true; } diff --git a/core/frontend/src/views/background/BackgroundOverall.vue b/core/frontend/src/views/background/BackgroundOverall.vue index a6bd5e5f85..cfc7e9cf94 100644 --- a/core/frontend/src/views/background/BackgroundOverall.vue +++ b/core/frontend/src/views/background/BackgroundOverall.vue @@ -110,7 +110,7 @@