Skip to content

Commit

Permalink
Consistent trace logging in PathResourceResolver
Browse files Browse the repository at this point in the history
Issue: SPR-16616
  • Loading branch information
jhoeller committed Mar 29, 2018
1 parent 53d0139 commit 695bf29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ protected Mono<Resource> getResource(String resourcePath, Resource location) {
}
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()) {
Expand Down Expand Up @@ -195,7 +195,7 @@ private boolean isInvalidEncodedPath(String resourcePath) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ protected Resource getResource(String resourcePath, Resource location) throws IO
}
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;
Expand Down Expand Up @@ -286,7 +286,7 @@ private boolean isInvalidEncodedPath(String resourcePath) {
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;
}
Expand Down

0 comments on commit 695bf29

Please sign in to comment.