Improvement in AntPathMatcher.combine method
Issues: SPR-7970
This commit is contained in:
parent
4653dbe73f
commit
9833a4c385
|
|
@ -299,7 +299,9 @@ public class AntPathMatcher implements PathMatcher {
|
|||
else if (!StringUtils.hasText(pattern2)) {
|
||||
return pattern1;
|
||||
}
|
||||
else if (!pattern1.contains("{") && match(pattern1, pattern2)) {
|
||||
else if (!pattern1.equals(pattern2) && !pattern1.contains("{") && match(pattern1, pattern2)) {
|
||||
// /* + /hotel -> /hotel ; "/*.*" + "/*.html" -> /*.html
|
||||
// However /user + /user -> /usr/user ; /{foo} + /bar -> /{foo}/bar
|
||||
return pattern2;
|
||||
}
|
||||
else if (pattern1.endsWith("/*")) {
|
||||
|
|
|
|||
|
|
@ -410,7 +410,8 @@ public class AntPathMatcherTests {
|
|||
assertEquals("/*.html", pathMatcher.combine("/**", "/*.html"));
|
||||
assertEquals("/*.html", pathMatcher.combine("/*", "/*.html"));
|
||||
assertEquals("/*.html", pathMatcher.combine("/*.*", "/*.html"));
|
||||
assertEquals("/{foo}/bar", pathMatcher.combine("/{foo}", "/bar"));
|
||||
assertEquals("/{foo}/bar", pathMatcher.combine("/{foo}", "/bar")); // SPR-8858
|
||||
assertEquals("/user/user", pathMatcher.combine("/user", "/user")); // SPR-7970
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue