Skip to content
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

Specified MVC resource at root level not considered "under location" [SPR-12747] #17344

Closed
spring-projects-issues opened this issue Feb 23, 2015 · 1 comment
Assignees
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

Comments

@spring-projects-issues
Copy link
Collaborator

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

@spring-projects-issues
Copy link
Collaborator Author

Brian Clozel commented

This is now fixed in master.
Also backported in 4.1.x with 2c47098b and in 3.2.x with 2d3fe96c.

Thanks for this report!

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1.6 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants