PathVariable consistently reflects value up to 1st ";"
Given "/{foo}" and "/a=42;c=b", previously that would be treated as a
sequence of matrix vars with an empty path variable. After the change
the path variable "foo" is "a=42".
This should be ok for backawards compatibility since it's unlikely for
anything to rely on an empty path variable.
Issue: SPR-11897
This commit is contained in:
@@ -149,20 +149,23 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
|
||||
Map<String, MultiValueMap<String, String>> result = new LinkedHashMap<>();
|
||||
uriVariables.forEach((uriVarKey, uriVarValue) -> {
|
||||
|
||||
int equalsIndex = uriVarValue.indexOf('=');
|
||||
if (equalsIndex == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
String matrixVariables;
|
||||
|
||||
int semicolonIndex = uriVarValue.indexOf(';');
|
||||
if ((semicolonIndex == -1) || (semicolonIndex == 0) || (equalsIndex < semicolonIndex)) {
|
||||
if (semicolonIndex != -1 && semicolonIndex != 0) {
|
||||
uriVariables.put(uriVarKey, uriVarValue.substring(0, semicolonIndex));
|
||||
}
|
||||
|
||||
String matrixVariables;
|
||||
if (semicolonIndex == -1 || semicolonIndex == 0 || equalsIndex < semicolonIndex) {
|
||||
matrixVariables = uriVarValue;
|
||||
}
|
||||
else {
|
||||
matrixVariables = uriVarValue.substring(semicolonIndex + 1);
|
||||
uriVariables.put(uriVarKey, uriVarValue.substring(0, semicolonIndex));
|
||||
}
|
||||
|
||||
MultiValueMap<String, String> vars = WebUtils.parseMatrixVariables(matrixVariables);
|
||||
|
||||
Reference in New Issue
Block a user