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\ 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

Comment From: spring-projects-issues

Rossen Stoyanchev commented

I checked the raw request and the comma is translated to %2C so this shouldn't happen.

Request parameter values from the ServletRequest are provided in decoded form so I'm not sure this has anything to do with it.

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.

Comment From: spring-projects-issues

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.

Comment From: RomainWilbert

Same issue here...even if the comma is escaped (%2C) the string is split into 2 values :(

Comment From: rstoyanchev

This is actually a duplicate of #23820.

Comment From: fy-kenny

I redirect request parameters contains String arrays, but the dest request received one,two,... as only one param. how can i delimiter automatically. @rstoyanchev

Class Pojo { List list; }

redirectAttributes.addAllAttributes(request.getParameterMap());