Match manifest-specified jar names with pre-encoded escape sequence

Closes gh-37280
This commit is contained in:
Juergen Hoeller
2026-09-18 20:58:46 +02:00
parent 2a15cd498a
commit 83ecf67455
@@ -1294,6 +1294,16 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
static ClassPathManifestEntry of(File file, @Nullable Boolean useCaches) throws MalformedURLException {
String path = fixPath(file.getAbsolutePath());
Resource resource = asJarFileResource(path, useCaches);
if (!resource.exists()) {
String encodedPath = fixPath(StringUtils.replace(file.getAbsolutePath(), "%", "%25"));
if (!encodedPath.equals(path)) {
Resource encodedResource = asJarFileResource(encodedPath, useCaches);
if (encodedResource.exists()) {
path = encodedPath;
resource = encodedResource;
}
}
}
Resource alternative = createAlternative(path, useCaches);
return new ClassPathManifestEntry(resource, alternative);
}
@@ -1316,7 +1326,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
*/
private static @Nullable Resource createAlternative(String path, @Nullable Boolean useCaches) {
try {
String alternativePath = path.startsWith("/") ? path.substring(1) : "/" + path;
String alternativePath = (path.startsWith("/") ? path.substring(1) : "/" + path);
return asJarFileResource(alternativePath, useCaches);
}
catch (MalformedURLException ex) {