mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Properly extract jar file from Tomcat war URL
Issue: SPR-15485
This commit is contained in:
+5
-2
@@ -576,10 +576,13 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
|||||||
// We'll also handle paths with and without leading "file:" prefix.
|
// We'll also handle paths with and without leading "file:" prefix.
|
||||||
String urlFile = rootDirURL.getFile();
|
String urlFile = rootDirURL.getFile();
|
||||||
try {
|
try {
|
||||||
int separatorIndex = urlFile.indexOf(ResourceUtils.JAR_URL_SEPARATOR);
|
int separatorIndex = urlFile.indexOf(ResourceUtils.WAR_URL_SEPARATOR);
|
||||||
|
if (separatorIndex == -1) {
|
||||||
|
separatorIndex = urlFile.indexOf(ResourceUtils.JAR_URL_SEPARATOR);
|
||||||
|
}
|
||||||
if (separatorIndex != -1) {
|
if (separatorIndex != -1) {
|
||||||
jarFileUrl = urlFile.substring(0, separatorIndex);
|
jarFileUrl = urlFile.substring(0, separatorIndex);
|
||||||
rootEntryPath = urlFile.substring(separatorIndex + ResourceUtils.JAR_URL_SEPARATOR.length());
|
rootEntryPath = urlFile.substring(separatorIndex + 2); // both separators are 2 chars
|
||||||
jarFile = getJarFile(jarFileUrl);
|
jarFile = getJarFile(jarFileUrl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user