mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-08 16:19:48 +00:00
Allow file locations for resource handling
Prior to this change, location checks for serving resources would append `/` to the location path it didn't already have one. This commit makes sure not to append a `/` if the provided location is actually a file. Issue: SPR-12747
This commit is contained in:
+3
@@ -179,6 +179,9 @@ public class PathResourceResolver extends AbstractResourceResolver {
|
||||
resourcePath = resource.getURL().getPath();
|
||||
locationPath = StringUtils.cleanPath(location.getURL().getPath());
|
||||
}
|
||||
if(locationPath.equals(resourcePath)) {
|
||||
return true;
|
||||
}
|
||||
locationPath = (locationPath.endsWith("/") || locationPath.isEmpty() ? locationPath : locationPath + "/");
|
||||
if (!resourcePath.startsWith(locationPath)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user