Specified MVC resource at root level not considered "under location" [SPR-12747] #17344
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Silvio Assunção Junior opened SPR-12747 and commented
I use now Spring 3.2.2 and I'm upgrading to 3.2.13 but I found a error on ResourceHttpRequestHandler
I configured my MVC resources example:
<mvc:resources location="/favicon.ico" mapping="/favicon.ico" cache-period="31556926"/>
When I request the favicon (http://localhost:8080/favicon.ico) I receive 404 (Not found). I debug the ResourceHttpRequestHandler and see that in this version has a method that in old version don't have "isResourceUnderLocation"
This method have a validation that I think is wrong
if (!resourcePath.startsWith(locationPath)) {
return false;
}
The correct in this case is locationPath.startsWith(resourcePath) because before this validation we have this code bellow
locationPath = (locationPath.endsWith("/") ||
!StringUtils.hasLength(locationPath) ? locationPath : locationPath + "/");
Affects: 3.2.13, 4.1.4
Backported to: 3.2.14
The text was updated successfully, but these errors were encountered: