From 48cf4250b4eed777b8d95b5fc69f0cbd6a8eefed Mon Sep 17 00:00:00 2001 From: DokiYoloo <857815116@qq.com> Date: Thu, 25 Feb 2021 23:35:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAuthFilter=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E8=BF=87=E6=BB=A4=E5=8C=B9=E9=85=8D=E4=B8=8D=E7=B2=BE?= =?UTF-8?q?=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/core/utils/StringUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java index e0bc15a2..b1501699 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java @@ -477,10 +477,14 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils // 匹配前缀Pattern result = remainingURI.contains(prefixPattern); - // 已经没有星号,直接返回 + // 已经没有星号,判断长度是否符合,并返回 if (formerStarOffset == -1) { - return result; + //清洗请求路径 + if (remainingURI.endsWith("/")) { + remainingURI = remainingURI.substring(0, remainingURI.length() - 1); + } + return remainingURI.length() == prefixPattern.length(); } // 匹配失败,直接返回