Consistent logging of encoded path evaluation failure
Issue: SPR-16616
This commit is contained in:
parent
75f70b269e
commit
98ad23bef8
|
@ -193,7 +193,12 @@ public class PathResourceResolver extends AbstractResourceResolver {
|
|||
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars...
|
||||
try {
|
||||
String decodedPath = URLDecoder.decode(resourcePath, "UTF-8");
|
||||
return (decodedPath.contains("../") || decodedPath.contains("..\\"));
|
||||
if (decodedPath.contains("../") || decodedPath.contains("..\\")) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Ignoring invalid resource path with escape sequences [" + resourcePath + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (UnsupportedEncodingException ex) {
|
||||
// Should never happen...
|
||||
|
|
|
@ -284,7 +284,12 @@ public class PathResourceResolver extends AbstractResourceResolver {
|
|||
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars...
|
||||
try {
|
||||
String decodedPath = URLDecoder.decode(resourcePath, "UTF-8");
|
||||
return (decodedPath.contains("../") || decodedPath.contains("..\\"));
|
||||
if (decodedPath.contains("../") || decodedPath.contains("..\\")) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Ignoring invalid resource path with escape sequences [" + resourcePath + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (UnsupportedEncodingException ex) {
|
||||
// Should never happen...
|
||||
|
|
Loading…
Reference in New Issue