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-issuemaster opened this issue Feb 23, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Feb 23, 2015

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 27, 2015

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.