-
Notifications
You must be signed in to change notification settings - Fork 472
Encoded forward slashes in URL cause wrong links #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example when calling this URL:
http://localhost:8080/things/%2Fsome%2Fthing
, then this is produced in the controller method:It prints
http://localhost:8080/things/some/thing/things/some/thing
where it should producehttp://localhost:8080/things/%2Fsome%2Fthing
.There are two problems:
%2F
. If the leading character is another one the mapping worksI'm well aware that slashes in path variables are problematic, but they do work in Spring MVC now, see https://jira.spring.io/browse/SPR-7919 & https://jira.spring.io/browse/SPR-11101
The problem could be in
ServletUriComponentsBuilder.fromServletMapping(HttpServletRequest)
where aUrlPathHelper
is instantiated which defaults tourlDecode = true
. The fix for having encoded slashes in Spring MVC is to seturlDecode = false
, I guess that's related. Maybe that could be made configurable?The text was updated successfully, but these errors were encountered: