File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
spring-webflux/src/main/java/org/springframework/web/reactive/resource
spring-webmvc/src/main/java/org/springframework/web/servlet/resource Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,12 @@ private boolean isInvalidEncodedPath(String resourcePath) {
193
193
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars...
194
194
try {
195
195
String decodedPath = URLDecoder .decode (resourcePath , "UTF-8" );
196
- return (decodedPath .contains ("../" ) || decodedPath .contains ("..\\ " ));
196
+ if (decodedPath .contains ("../" ) || decodedPath .contains ("..\\ " )) {
197
+ if (logger .isTraceEnabled ()) {
198
+ logger .trace ("Ignoring invalid resource path with escape sequences [" + resourcePath + "]" );
199
+ }
200
+ return true ;
201
+ }
197
202
}
198
203
catch (UnsupportedEncodingException ex ) {
199
204
// Should never happen...
Original file line number Diff line number Diff line change @@ -284,7 +284,12 @@ 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
- return (decodedPath .contains ("../" ) || decodedPath .contains ("..\\ " ));
287
+ if (decodedPath .contains ("../" ) || decodedPath .contains ("..\\ " )) {
288
+ if (logger .isTraceEnabled ()) {
289
+ logger .trace ("Ignoring invalid resource path with escape sequences [" + resourcePath + "]" );
290
+ }
291
+ return true ;
292
+ }
288
293
}
289
294
catch (UnsupportedEncodingException ex ) {
290
295
// Should never happen...
You can’t perform that action at this time.
0 commit comments