Skip to content

Commit

Permalink
Fix v2 routing regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarco76 committed Jul 22, 2024
1 parent feb03c6 commit ae45377
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public Method getActionMethod(HttpMethod met, String path) {
}
String keyPath = webActions.keySet().stream().
filter( key -> {
String keyRegex = key.replace("{}", "([A-Za-z0-9_\\-\\.\\\s]+)");
String keyRegex = key.replace("{}", "([^/]+)");
return reqMethod.matches(keyRegex);
} ).
findFirst().
Expand All @@ -176,9 +176,9 @@ public String getAllowedMethods(String path) {
List<String> keyPaths = webActions.keySet().stream().
filter( key -> {
String keyRegex = key.substring(key.indexOf(":") + 1);
keyRegex = keyRegex.replace("{}", "([A-Za-z0-9_\\-\\.\\\s]+)");
keyRegex = keyRegex.replace("{}", "([^/]+)");
return matchingPath.matches(keyRegex);
} ).
}).
collect(Collectors.toList());
if (keyPaths == null || keyPaths.isEmpty()) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
if (aclMap!=null) {
Optional<String> aclKey = aclMap.keySet().stream().
filter( key -> {
String keyRegex = key.replaceFirst("\\*", ".*").replace("{}", "([A-Za-z0-9_\\-\\.\\\s]+)");
String keyRegex = key.replaceFirst("\\*", ".*").replace("{}", "([^/]+)");
return aclSearch.matches(keyRegex);
} ).
sorted(Comparator.reverseOrder()).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
if (authMethodMap!=null) {
Optional<String> autMethodKey = authMethodMap.keySet().stream().
filter( key -> {
String keyRegex = key.replaceFirst("\\*", ".*").replace("{}", "([A-Za-z0-9_\\-\\.\\\s]+)");
String keyRegex = key.replaceFirst("\\*", ".*").replace("{}", "([^/]+)");
return authMethodSearch.matches(keyRegex);
} ).
sorted(Comparator.reverseOrder()).
Expand Down

0 comments on commit ae45377

Please sign in to comment.