Fix ServiceConfig.checkPathPattern bug

This commit is contained in:
hongqiaowei
2021-11-25 17:54:50 +08:00
parent 6388913699
commit 0d8b8a1668

View File

@@ -124,23 +124,23 @@ public class ServiceConfig {
private void checkPathPattern(Map<String, Set<ApiConfig>> pathPattern2apiConfigMap, boolean dedicatedLineRequest, String path, ArrayList<ApiConfig> result) { private void checkPathPattern(Map<String, Set<ApiConfig>> pathPattern2apiConfigMap, boolean dedicatedLineRequest, String path, ArrayList<ApiConfig> result) {
Set<Map.Entry<String, Set<ApiConfig>>> entries = pathPattern2apiConfigMap.entrySet(); Set<Map.Entry<String, Set<ApiConfig>>> entries = pathPattern2apiConfigMap.entrySet();
boolean clear = false; // boolean clear = false;
for (Map.Entry<String, Set<ApiConfig>> entry : entries) { for (Map.Entry<String, Set<ApiConfig>> entry : entries) {
String pathPattern = entry.getKey(); String pathPattern = entry.getKey();
Set<ApiConfig> apiConfigs = entry.getValue(); Set<ApiConfig> apiConfigs = entry.getValue();
if (pathPattern.equals(path)) { if (pathPattern.equals(path)) {
for (ApiConfig ac : apiConfigs) { for (ApiConfig ac : apiConfigs) {
if (ac.allowAccess) { if (ac.allowAccess) {
if (!clear && !result.isEmpty()) { /*if (!clear && !result.isEmpty()) {
result.clear(); result.clear();
clear = true; clear = true;
} }*/
result.add(ac); result.add(ac);
} }
} }
if (clear && !result.isEmpty()) { /*if (clear && !result.isEmpty()) {
return; return;
} }*/
} else if (UrlTransformUtils.ANT_PATH_MATCHER.match(pathPattern, path)) { } else if (UrlTransformUtils.ANT_PATH_MATCHER.match(pathPattern, path)) {
for (ApiConfig ac : apiConfigs) { for (ApiConfig ac : apiConfigs) {
if (ac.allowAccess) { if (ac.allowAccess) {