Use file urls for unpacked jars
Update `JarFileArchive` so that unpacked jars use `file:` URLs rather than `jar:file:`. This aligns with the behavior of Spring Boot 3.1 and allows calls to `class.getSigners()` to work again. Fixes gh-38833
This commit is contained in:
@@ -113,7 +113,7 @@ class JarFileArchive implements Archive {
|
||||
if (!Files.exists(path) || Files.size(path) != jarEntry.getSize()) {
|
||||
unpack(jarEntry, path);
|
||||
}
|
||||
return JarUrl.create(path.toFile());
|
||||
return path.toUri().toURL();
|
||||
}
|
||||
|
||||
private Path getTempUnpackDirectory() {
|
||||
|
||||
@@ -112,7 +112,8 @@ class JarFileArchiveTests {
|
||||
assertThat(urls).hasSize(1);
|
||||
URL url = urls.iterator().next();
|
||||
assertThat(url).isNotEqualTo(JarUrl.create(this.file, "nested.jar"));
|
||||
assertThat(url.toString()).startsWith("jar:file:").endsWith("/nested.jar!/");
|
||||
// The unpack URL must be a raw file URL (see gh-38833)
|
||||
assertThat(url.toString()).startsWith("file:").endsWith("/nested.jar").doesNotStartWith("jar:");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user