mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-20 12:19:16 +00:00
Match manifest-specified jar names with pre-encoded escape sequence
Closes gh-37280
This commit is contained in:
+11
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user