mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 22:19:03 +00:00
Avoid pattern misdetection in Tomcat "war:" URL separator
Issue: SPR-15332
This commit is contained in:
+4
-3
@@ -284,9 +284,10 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Only look for a pattern after a prefix here
|
// Generally only look for a pattern after a prefix here,
|
||||||
// (to not get fooled by a pattern symbol in a strange prefix).
|
// and on Tomcat only after the "*/" separator for its "war:" protocol.
|
||||||
int prefixEnd = locationPattern.indexOf(":") + 1;
|
int prefixEnd = (locationPattern.startsWith("war:") ? locationPattern.indexOf("*/") + 1 :
|
||||||
|
locationPattern.indexOf(":") + 1);
|
||||||
if (getPathMatcher().isPattern(locationPattern.substring(prefixEnd))) {
|
if (getPathMatcher().isPattern(locationPattern.substring(prefixEnd))) {
|
||||||
// a file pattern
|
// a file pattern
|
||||||
return findPathMatchingResources(locationPattern);
|
return findPathMatchingResources(locationPattern);
|
||||||
|
|||||||
Reference in New Issue
Block a user