-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringToCollectionConverter splits string by comma [SPR-15356] #19919
Comments
Rossen Stoyanchev commented
Request parameter values from the The description of the issue is insufficient. Could you provide an example of what the target Object and field(s) look like? Also the corresponding form fields and data. |
Sebastian Monte commented I also run to this issue. URL path: /endpoint?param=1%2C2 In the controller I have a request parameter: @RequestParam(value = "param", required = false) final Set<String> params The "params" Set will include two values ("1" and "2"). I would expect the "params" set to contain one value "1,2" since the comma is escaped. |
Same issue here...even if the comma is escaped (%2C) the string is split into 2 values :( |
This is actually a duplicate of #23820. |
I redirect request parameters contains String arrays, but the dest request received Class Pojo { redirectAttributes.addAllAttributes(request.getParameterMap()); |
None opened SPR-15356 and commented
When you submit a form (only tried post) with a parameter that includes a comma, and the parameter is bound to a List<String> then this value is passed through to the method
org.springframework.core.convert.support.StringToCollectionConverter.convert(Object, TypeDescriptor, TypeDescriptor)
. That method then splits the String at the comma, resulting in a list with two elements instead of one.I understand that comma is used to split array values in the url. I checked the raw request and the comma is translated to %2C so this shouldn't happen. It must be a bug somewhere in the call hierachy.
This problem only exists if one value is submitted for the list. If two or more values are submitted (e.g. two checkboxes checked) then a different converter is choosen (array to list) and no comma splitting is done.
Affects: 4.3.7
The text was updated successfully, but these errors were encountered: