[MAGNOLIA-3264] UnicodeNormalizerRequestWrapper.getParameterMap() may return a stale result in case of forwards Created: 03/Aug/10  Updated: 26/Oct/10  Resolved: 20/Oct/10

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 4.3.5
Fix Version/s: 4.3.8

Type: Bug Priority: Major
Reporter: Fabrizio Giustina Assignee: Ondrej Chytil
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MAGNOLIA-3337 Request Wrappers hide changes in upst... Closed
relation
is related to MAGNOLIA-3310 UnicodeNormalizationFilter seems to b... Closed
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   

When utf8 is enabled, forwards with added parameters may not work correctly due to unicode normalization which doesn't "see" added parameters.

For example, if you have a regexp virtual uri with:

^/my/path/(.*)\.html
forward://my/path/page.html?product=$1

the "product" parameter is seen in the destination page only if uft8 is disabled.
This is due to the getParameterMap() method in UnicodeNormalizerRequestWrapper which caches the map with normalized parameters after the forward:

        public Map getParameterMap()
        {            
            if (parameters == null)
            {
                parameters = new HashMap<String, String[]>();
                for (Object key : original.getParameterMap().keySet())
                {
                    String[] value = transform((String[]) original.getParameterMap().get(key));
                    parameters.put(key, value);
                }
            }
            return parameters;
        }

removing the " if (parameters == null)" check and making normalization all the times is enough to fix it, but this will add an unwanted overhead. We should find a way to re-normalize the parameter map only when the request gets overridden



 Comments   
Comment by Ondrej Chytil [ 20/Oct/10 ]

Resolved with MAGNOLIA-3310.

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