Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3264

UnicodeNormalizerRequestWrapper.getParameterMap() may return a stale result in case of forwards

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • 4.3.8
    • 4.3.5
    • None
    • None

      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

        Acceptance criteria

              ochytil Ondrej Chytil
              fgiust Fabrizio Giustina
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD