[MGNLREST-394] REST requests with Umlaut characters in URL fail Created: 23/May/22  Updated: 20/Jun/22  Resolved: 25/May/22

Status: Closed
Project: Magnolia REST Framework
Component/s: integration
Affects Version/s: 3.0.0
Fix Version/s: 3.0.0

Type: Bug Priority: Critical
Reporter: Michael Duerig Assignee: Michael Duerig
Resolution: Fixed Votes: 0
Labels: VN-Testing, foundation_team
Remaining Estimate: Not Specified
Time Spent: 1h
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes MGNLTEST-235 Cleanup fails to delete nodes with UT... Closed
causes MGNLTEST-236 MagnoliaRestClient#nodeExists fails t... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Epic Link: 6.3 Consolidation
Team: Foundation

 Description   

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
 

 


Generated at Mon Feb 12 06:59:29 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.