File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
spring-webmvc/src/main/java/org/springframework/web/servlet/resource Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
30
30
import org .apache .commons .logging .LogFactory ;
31
31
32
32
import org .springframework .lang .Nullable ;
33
+ import org .springframework .util .Assert ;
33
34
import org .springframework .web .filter .GenericFilterBean ;
34
35
import org .springframework .web .util .UrlPathHelper ;
35
36
@@ -96,6 +97,10 @@ private void initLookupPath(ResourceUrlProvider urlProvider) {
96
97
String requestUri = pathHelper .getRequestUri (this );
97
98
String lookupPath = pathHelper .getLookupPathForRequest (this );
98
99
this .indexLookupPath = requestUri .lastIndexOf (lookupPath );
100
+ Assert .isTrue (this .indexLookupPath != -1 , () ->
101
+ "Failed to find lookupPath '" + lookupPath + "' within requestUri '" + requestUri + ". " +
102
+ "Does the path have invalid encoded characters " +
103
+ "for characterEncoding=" + getRequest ().getCharacterEncoding () + "?" );
99
104
this .prefixLookupPath = requestUri .substring (0 , this .indexLookupPath );
100
105
if ("/" .equals (lookupPath ) && !"/" .equals (requestUri )) {
101
106
String contextPath = pathHelper .getContextPath (this );
You can’t perform that action at this time.
0 commit comments