Merge pull request #13706 from izeye:duplicate-empty-path

* pr/13706:
  Prevent duplicate RequestMatcher in RequestMatcherFactory.antPath()
pull/13815/head
Stephane Nicoll 6 years ago
commit 2dc0488af7

@ -299,12 +299,12 @@ public final class EndpointRequest {
List<RequestMatcher> antPath(String... parts) { List<RequestMatcher> antPath(String... parts) {
List<RequestMatcher> matchers = new ArrayList<>(); List<RequestMatcher> matchers = new ArrayList<>();
this.servletPaths.stream().map((p) -> { this.servletPaths.stream().map((p) -> {
if (StringUtils.hasText(p)) { if (StringUtils.hasText(p) && !p.equals("/")) {
return p; return p;
} }
return ""; return "";
}).distinct().forEach((path) -> { }).distinct().forEach((path) -> {
String pattern = (path.equals("/") ? "" : path); String pattern = path;
for (String part : parts) { for (String part : parts) {
pattern += part; pattern += part;
} }

Loading…
Cancel
Save