[MAGNOLIA-3423] UnicodeNormalizerRequestWrapper cannot handle multiple parameter values Created: 29/Nov/10  Updated: 23/Jan/13  Resolved: 21/Dec/10

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.3.8
Fix Version/s: 4.4

Type: Bug Priority: Major
Reporter: Frank Rittinger Assignee: Tobias Mattsson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

I have a problem saving multiple categories while UTF8 support is enabled: Only the last category is persisted to the JCR. Even if multiple categories are selected. Without UTF8 all works as expected. This should also affect all form submits with multiple parameter values, e.g. multiselect lists with UTF8 enabled.

I debugged into magnolia and think that the problem is inside the UnicodeNormalizerRequestWrapper. When UTF8 support is activated, the request is additionaly wrapped by the UnicodeNormalizerRequestWrapper.

The save action of the CategorizationSaveHandler uses MgnlContext.getParameterValues(name) to retrieve the values that should be persisted. Finally, this calls this.request.getParameterValues(name).

Without UTF8 support this will end up in MultipartRequestWrapper.getParameterValues(name) which calls form.getParameterValues(name) which returns a list of all values for this name. So far, so good.

But, with UTF8 enabled the call to this.request.getParameterValues ends up in UnicodeNormalizerRequestWrapper.getParameterValues which gets the result from original.getParameterMap where original is the MultipartequestWrapper.getParameterMap which calls form.getParameter which only stores the last value of all categories that were send in the original request instead of a list of all values.

I think UnicodeNormalizerRequestWrapper.getParameterValues should also call original.getParameterValues instead of getParameterMap.

see info.magnolia.cms.filters.UnicodeNormalizationFilter:187



 Comments   
Comment by Magnolia International [ 17/Dec/10 ]

Thanks for the detailed report, Frank ! Trying to push a fix for this into the upcoming 4.4.2; a patch tested would be welcome of course

Comment by Frank Rittinger [ 17/Dec/10 ]

Hi Gregory, isn't this issue not already fixed by the new magnolia version (4.4.1). I looked briefely into the code and had the feeling that the UnicodeNormalizerRequestWrapper was completely rewritten.It also got a new name: UnicodeNormalizationRequestWrapper ...

Comment by Philipp Bärfuss [ 21/Dec/10 ]

I think this is fixed in 4.4 (we are not going to backport to 4.3). Tobias can you confirm/resolve the issue?

Comment by Tobias Mattsson [ 21/Dec/10 ]

Confirmed, as of MAGNOLIA-3337 (4.4) the call is to getParameterValues() instead of getParameterMap(). The described problem can be fixed by upgrading to 4.4.

Generated at Mon Feb 12 03:46:20 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.