根据作者意见,进行代码优化

This commit is contained in:
xiefangzhen 2025-01-05 09:17:43 +08:00
parent 97e28f289b
commit 256b40b388
1 changed files with 2 additions and 3 deletions

View File

@ -20,9 +20,8 @@ public abstract class ApiRequestFilter extends OncePerRequestFilter {
@Override
protected boolean shouldNotFilter(HttpServletRequest request) {
// 只过滤 API 请求的地址
String contextPath = request.getContextPath();
return !StrUtil.startWithAny(request.getRequestURI().substring(contextPath.length()), webProperties.getAdminApi().getPrefix(),
webProperties.getAppApi().getPrefix());
String apiUri = request.getRequestURI().substring(request.getContextPath().length());
return !StrUtil.startWithAny(apiUri, webProperties.getAdminApi().getPrefix(), webProperties.getAppApi().getPrefix());
}
}