mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Fix '**' parsing within a PathPattern segment
Prior to this commit, a regexp path segment ending with a double wilcard
(like "/path**") would be incorrectly parsed as a double wildcard
segment ("/**").
This commit fixes the incorrect parsing.
See gh-35679
This commit is contained in:
+10
-2
@@ -236,14 +236,22 @@ class InternalPathPatternParser {
|
||||
}
|
||||
|
||||
private boolean isDoubleWildcard(char separator) {
|
||||
// next char is present
|
||||
if ((this.pos + 1) >= this.pathPatternLength) {
|
||||
return false;
|
||||
}
|
||||
// current char and next char are '*'
|
||||
if (this.pathPatternData[this.pos] != '*' || this.pathPatternData[this.pos + 1] != '*') {
|
||||
return false;
|
||||
}
|
||||
if ((this.pos + 2) < this.pathPatternLength) {
|
||||
return this.pathPatternData[this.pos + 2] == separator;
|
||||
// previous char is a separator, if any
|
||||
if ((this.pos - 1 >= 0) && (this.pathPatternData[this.pos - 1] != separator)) {
|
||||
return false;
|
||||
}
|
||||
// next char is a separator, if any
|
||||
if (((this.pos + 2) < this.pathPatternLength) &&
|
||||
this.pathPatternData[this.pos + 2] != separator) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user