Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-394

REST requests with Umlaut characters in URL fail

XMLWordPrintable

      Steps to reproduce

      Expected behaviour

      HTTP status 200

      Expected behaviour

      HTTP status 404

      Initial analysis

      The root cause is RestDispatcherServlet constructing a not correctly URL encoded URL by using HttpServletRequest.getPathInfo, which returns a decoded string.

      The following patch made the problem go away. There might be better ways to fix this thought.

      @@ -197,7 +197,7 @@
                   EnvironmentContextPerThread.runInEnvironmentContext(environment, () -> onEnvironmentAdded(environment));
               }
       
      -        final String relativePath = httpServletRequest.getPathInfo();
      +        final String relativePath = StringUtils.substringAfter(httpServletRequest.getRequestURL().toString(), httpServletRequest.getServletPath());
               HttpServletRequest environmentRequest = relativePath.startsWith("/environments") ? httpServletRequest :
                       new HttpServletRequestWrapper(httpServletRequest) {
                           @Override
       

       

        Acceptance criteria

              mduerig Michael Duerig
              mduerig Michael Duerig
              Foundation
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 1h
                    1h