File tree 1 file changed +1
-10
lines changed
spring-webmvc/src/main/java/org/springframework/web/servlet/resource
1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change @@ -284,16 +284,7 @@ private boolean isInvalidEncodedPath(String resourcePath) {
284
284
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars...
285
285
try {
286
286
String decodedPath = URLDecoder .decode (resourcePath , "UTF-8" );
287
- int separatorIndex = decodedPath .indexOf (".." ) + 2 ;
288
- if (separatorIndex > 1 && separatorIndex < decodedPath .length ()) {
289
- char separator = decodedPath .charAt (separatorIndex );
290
- if (separator == '/' || separator == '\\' ) {
291
- if (logger .isTraceEnabled ()) {
292
- logger .trace ("Resolved resource path contains \" ../\" after decoding: " + resourcePath );
293
- }
294
- }
295
- return true ;
296
- }
287
+ return (decodedPath .contains ("../" ) || decodedPath .contains ("..\\ " ));
297
288
}
298
289
catch (UnsupportedEncodingException ex ) {
299
290
// Should never happen...
You can’t perform that action at this time.
0 commit comments