-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Peter De Wachter opened SPR-10467 and commented
I have a webapp configured for the path /test, a servlet-mapping in web.xml for the url-pattern '/*' to a DispatcherServlet and a @RequestMapping
"/foo/bar". The container is Tomcat 7.
With this setup the following request succeeds:
http://host/test/foo/bar => OK
And also if you add double slashes to the request mapping part:
http://host/test//foo//bar => OK
But if you use a double slash in the context path, it fails:
http://host//test/foo/bar => 404
This is a very minor issue, but it can be annoying as scripts often construct URLs in an ad-hoc manner and end up with doubled slashes.
The reason is that UrlPathHelper#getPathWithinApplication gets confused by the double slash. getContextPath returns "/test", getRequestUri returns "//test/foo/bar" and as a result getRemainingPart fails.
I suspect the fix is to make decodeAndCleanUriString replace "//" by "/".
Affects: 3.2.2
Issue Links:
- Two trailing slashes and the default servlet cannot resolve to a controller [SPR-12372] #16979 Two trailing slashes and the default servlet cannot resolve to a controller ("duplicates")