Issue Details (XML | Word | Printable)

Key: MGNLSTRIPES-4
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Fabrizio Giustina
Reporter: Danilo Ghirardelli
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Stripes module for Magnolia CMS

Multipart form has request parameters "multiplied"

Created: 07/Jun/10 11:41   Updated: 08/Aug/11 14:42   Resolved: 08/Aug/11 13:20
Component/s: None
Affects Version/s: 4.1
Fix Version/s: 4.1.3

File Attachments: 1. Java Source File MagnoliaAlternateMultipartWrapper.java (2 kB) 07/Jun/10 11:41 - Danilo Ghirardelli



 Description  « Hide

When submitting a multipart form to a Magnolia page, all request parameters' values are inserted multiple times in the String[] of values. This is not really a problem until you have _eventName or a String[] as parameter, and in these cases you need non-duplicated values.

The problem is caused by stripes, that tries to "merge" request parameters with uri parameters: see class MergedParameterMap (at line 339 to be precise) for more info. The merge is not done by replacing parameters with the same key in the map but adding values to the values array. In the multipart request, all parameters are already set in the map by Magnolia itself, but using MergedParameterMap, stripes just re-adds them to the map each time an action is called. So if the original multipart request form has a parameter like _eventName=show, the resulting request will have _eventName=[show, show, show].

The attached patch is a modification of the original MagnoliaMultipartWrapper that does not return any parameter, because they are already in the Magnolia parsed request, avoiding parameters duplication.



Fabrizio Giustina added a comment - 08/Aug/11 13:20

patch committed for version 4.1.3


Danilo Ghirardelli added a comment - 08/Aug/11 13:27

Just to leave a bit of history, this may be related to:
http://jira.magnolia-cms.com/browse/MAGNOLIA-3337
I didn't try if this solution is really needed anymore once that issue was fixed.