Merge branch '6.2.x'

This commit is contained in:
Sébastien Deleuze
2025-03-17 11:42:06 +01:00
2 changed files with 47 additions and 9 deletions

View File

@@ -350,17 +350,22 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
String[] pairs = StringUtils.tokenizeToStringArray(body, "&");
MultiValueMap<String, String> result = new LinkedMultiValueMap<>(pairs.length);
for (String pair : pairs) {
int idx = pair.indexOf('=');
if (idx == -1) {
result.add(URLDecoder.decode(pair, charset), null);
}
else {
String name = URLDecoder.decode(pair.substring(0, idx), charset);
String value = URLDecoder.decode(pair.substring(idx + 1), charset);
result.add(name, value);
try {
for (String pair : pairs) {
int idx = pair.indexOf('=');
if (idx == -1) {
result.add(URLDecoder.decode(pair, charset), null);
}
else {
String name = URLDecoder.decode(pair.substring(0, idx), charset);
String value = URLDecoder.decode(pair.substring(idx + 1), charset);
result.add(name, value);
}
}
}
catch (IllegalArgumentException ex) {
throw new HttpMessageNotReadableException("Could not decode HTTP form payload", ex, inputMessage);
}
return result;
}