Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
7.0.0
-
None
-
None
Description
One of the changes in https://github.com/apache/struts/pull/861 broke query parameters in multipart requests. Their values are being lost.
This is the old implementation, which returns null if the parameter doesn't exist.
public String[] getParameterValues(String name) { List<String> v = params.get(name); if (v != null && !v.isEmpty()) { return v.toArray(new String[0]); } return null; }
And this is the new implementation, which returns an empty array in that case.
public String[] getParameterValues(String name) { return parameters.getOrDefault(name, Collections.emptyList()) .toArray(String[]::new); }
This method in MultiPartRequestWrapper is expecting null to be returned in that case.
public String[] getParameterValues(String name) { return ((multi == null) || (multi.getParameterValues(name) == null)) ? super.getParameterValues(name) : multi.getParameterValues(name); }
Attachments
Issue Links
- links to