Fix ResourceUrlProvider path check in getForRequestUrl
Prior to this change, getForRequestUrl implementation would only work for applications with a non-empty servlet path. So web applications mapped to "/" would trigger a IllegalStateException while checking the current request against the request path within the current mapping. This change relaxes this and only check that the path within mapping is within the request URL. Issue: SPR-12158
This commit is contained in:
@@ -180,7 +180,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
||||
}
|
||||
|
||||
int index = getPathHelper().getRequestUri(request).indexOf(pathWithinMapping);
|
||||
Assert.state(index > 0 && index < requestUrl.length(), "Failed to determine lookup path: " + requestUrl);
|
||||
Assert.state(index != -1, "Failed to determine lookup path: " + requestUrl);
|
||||
|
||||
String prefix = requestUrl.substring(0, index);
|
||||
String lookupPath = requestUrl.substring(index);
|
||||
|
||||
Reference in New Issue
Block a user