Use custom path separator for pattern comparisons
As pointed out in gh-33085, the `AntPatternComparator` hardcodes the "/" separator when checking for "catch all" patterns like "/**". This commit ensures that the custom path separator is used for those checks, in order to guarantee consistent comparator results. See gh-33085
This commit is contained in:
@@ -524,6 +524,16 @@ class AntPathMatcherTests {
|
||||
assertThat(comparator.compare("*/**", "*")).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void patternComparatorWithDotSeparator() {
|
||||
Comparator<String> comparator = dotSeparatedPathMatcher.getPatternComparator("price.stock.spring");
|
||||
|
||||
assertThat(comparator.compare(null, null)).isEqualTo(0);
|
||||
assertThat(comparator.compare("price.stock.ticker/symbol", "price.stock.ticker/symbol")).isEqualTo(0);
|
||||
assertThat(comparator.compare("price.stock.**", "price.stock.ticker")).isEqualTo(1);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void patternComparatorSort() {
|
||||
Comparator<String> comparator = pathMatcher.getPatternComparator("/hotels/new");
|
||||
|
||||
Reference in New Issue
Block a user