File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
spring-core/src/main/java/org/springframework/core/io/support Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -634,12 +634,26 @@ private Set<ClassPathManifestEntry> getClassPathManifestEntriesFromJar(File jar)
634634 }
635635
636636 // Handle absolute paths correctly: do not apply parent to absolute paths.
637- File pathFile = new File (path );
638- File candidate = (pathFile .isAbsolute () ? pathFile : new File (parent , path ));
637+ File pathFile = null ;
638+ boolean absolute = false ;
639+ if (path .startsWith (ResourceUtils .FILE_URL_PREFIX )) {
640+ try {
641+ pathFile = new File (ResourceUtils .toURI (path ));
642+ absolute = true ;
643+ }
644+ catch (URISyntaxException | IllegalArgumentException ex ) {
645+ // Fall back to plain String constructor below.
646+ }
647+ }
648+ if (pathFile == null ) {
649+ pathFile = new File (path );
650+ absolute = pathFile .isAbsolute ();
651+ }
652+ File candidate = (absolute ? pathFile : new File (parent , path ));
639653
640654 // For relative paths, enforce security check: must be under parent.
641655 // For absolute paths, just verify file exists (matching JVM behavior).
642- if (candidate .isFile () && (pathFile . isAbsolute () ||
656+ if (candidate .isFile () && (absolute ||
643657 candidate .getCanonicalPath ().contains (parent .getCanonicalPath ()))) {
644658 manifestEntries .add (ClassPathManifestEntry .of (candidate , this .useCaches ));
645659 }
You can’t perform that action at this time.
0 commit comments