From 76e282c7965fdfa39854fe77397687bbc40d0f7f Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 28 Dec 2023 21:42:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=96=B0=E5=A2=9E=20PATH=5FPATTERN?= =?UTF-8?q?=20=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../continew/starter/core/constant/StringConstants.java | 5 +++++ .../local/autoconfigure/LocalStorageAutoConfiguration.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/StringConstants.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/StringConstants.java index ca67757a..3017bb20 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/StringConstants.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/StringConstants.java @@ -58,4 +58,9 @@ public class StringConstants implements StrPool { * 中文逗号 */ public static final String CHINESE_COMMA = ","; + + /** + * 路径模式 + */ + public static final String PATH_PATTERN = "/**"; } diff --git a/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java b/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java index b8f8e225..287b24d3 100644 --- a/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java +++ b/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java @@ -57,7 +57,7 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer { if (StrUtil.isBlank(location)) { throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern)); } - registry.addResourceHandler(pathPattern) + registry.addResourceHandler(StrUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN)) .addResourceLocations(!location.startsWith("file:") ? String.format("file:%s", this.format(location)) : this.format(location)) .setCachePeriod(0); }