From 97e28f289b9d760cc823399b7edd48dbfd4023c6 Mon Sep 17 00:00:00 2001 From: xiefangzhen Date: Fri, 3 Jan 2025 10:40:19 +0800 Subject: [PATCH] fix filter logic --- .DS_Store | Bin 8196 -> 8196 bytes .../web/core/filter/ApiRequestFilter.java | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.DS_Store b/.DS_Store index 8406d508bca176e90b7f717667ad1c8f1a08dc3d..a0cc682e9fc0e78be316502f41253d0a2607da9a 100644 GIT binary patch delta 40 wcmZp1XmOa}&nUhzU^hRb_+}n~M8?g_1ryjNHdt+Dm-xoA*h($ delta 78 zcmZp1XmOa}&nU4mU^hRb#AY6WL`H31hDwG~h7^WGhI|HHhE#?MAS;)lfFXw=)iWnQ hIVmSUiGhJZfPsP8d2^g#KHFw?iEk{M4~wuf0{{e!6MO&w diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java index 8e78a3b727..3b84933e37 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java @@ -20,7 +20,8 @@ public abstract class ApiRequestFilter extends OncePerRequestFilter { @Override protected boolean shouldNotFilter(HttpServletRequest request) { // 只过滤 API 请求的地址 - return !StrUtil.startWithAny(request.getRequestURI(), webProperties.getAdminApi().getPrefix(), + String contextPath = request.getContextPath(); + return !StrUtil.startWithAny(request.getRequestURI().substring(contextPath.length()), webProperties.getAdminApi().getPrefix(), webProperties.getAppApi().getPrefix()); }