[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: |
|
||||||||||||
| 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: | |||||||||||||
| Description |
Steps to reproduce
Expected behaviourHTTP status 200 Expected behaviourHTTP status 404 Initial analysisThe 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
|