From cbe4a49b54c56258da0fb419486ad9615d7b70ce Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Thu, 26 Feb 2015 17:16:44 +0100 Subject: [PATCH] Polish file locations in resource handling Issue: SPR-12747 --- .../web/servlet/resource/PathResourceResolver.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/PathResourceResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/PathResourceResolver.java index 4750d9c5d6..45f3b9e286 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/PathResourceResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/PathResourceResolver.java @@ -179,8 +179,10 @@ public class PathResourceResolver extends AbstractResourceResolver { resourcePath = resource.getURL().getPath(); locationPath = StringUtils.cleanPath(location.getURL().getPath()); } - locationPath = (StringUtils.getFilenameExtension(locationPath) != null - || locationPath.endsWith("/") || locationPath.isEmpty() ? locationPath : locationPath + "/"); + if(locationPath.equals(resourcePath)) { + return true; + } + locationPath = (locationPath.endsWith("/") || locationPath.isEmpty() ? locationPath : locationPath + "/"); if (!resourcePath.startsWith(locationPath)) { return false; }