diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/PathResourceResolver.java b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/PathResourceResolver.java index 404607542d..1f49cde6cb 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/PathResourceResolver.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/PathResourceResolver.java @@ -118,10 +118,10 @@ public class PathResourceResolver extends AbstractResourceResolver { } else if (logger.isTraceEnabled()) { Resource[] allowedLocations = getAllowedLocations(); - logger.trace("Resource path=\"" + resourcePath + "\" was successfully resolved " + - "but resource=\"" + resource.getURL() + "\" is neither under the " + - "current location=\"" + location.getURL() + "\" nor under any of the " + - "allowed locations=" + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]")); + logger.trace("Resource path \"" + resourcePath + "\" was successfully resolved " + + "but resource \"" + resource.getURL() + "\" is neither under the " + + "current location \"" + location.getURL() + "\" nor under any of the " + + "allowed locations " + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]")); } } else if (logger.isTraceEnabled()) { @@ -195,7 +195,7 @@ public class PathResourceResolver extends AbstractResourceResolver { String decodedPath = URLDecoder.decode(resourcePath, "UTF-8"); if (decodedPath.contains("../") || decodedPath.contains("..\\")) { if (logger.isTraceEnabled()) { - logger.trace("Ignoring invalid resource path with escape sequences [" + resourcePath + "]"); + logger.trace("Resolved resource path contains encoded \"../\" or \"..\\\": " + resourcePath); } return true; } 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 43a8397650..13de12e493 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 @@ -189,10 +189,10 @@ public class PathResourceResolver extends AbstractResourceResolver { } else if (logger.isTraceEnabled()) { Resource[] allowedLocations = getAllowedLocations(); - logger.trace("Resource path=\"" + resourcePath + "\" was successfully resolved " + - "but resource=\"" + resource.getURL() + "\" is neither under the " + - "current location=\"" + location.getURL() + "\" nor under any of the " + - "allowed locations=" + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]")); + logger.trace("Resource path \"" + resourcePath + "\" was successfully resolved " + + "but resource \"" + resource.getURL() + "\" is neither under the " + + "current location \"" + location.getURL() + "\" nor under any of the " + + "allowed locations " + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]")); } } return null; @@ -286,7 +286,7 @@ public class PathResourceResolver extends AbstractResourceResolver { String decodedPath = URLDecoder.decode(resourcePath, "UTF-8"); if (decodedPath.contains("../") || decodedPath.contains("..\\")) { if (logger.isTraceEnabled()) { - logger.trace("Ignoring invalid resource path with escape sequences [" + resourcePath + "]"); + logger.trace("Resolved resource path contains encoded \"../\" or \"..\\\": " + resourcePath); } return true; }