mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Remove redundant hash from path of unpacked nested library
Closes gh-4124
This commit is contained in:
parent
d55c001a2e
commit
7e718cda26
@ -114,12 +114,11 @@ public class JarFileArchive extends Archive {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Archive getUnpackedNestedArchive(JarEntryData data) throws IOException {
|
private Archive getUnpackedNestedArchive(JarEntryData data) throws IOException {
|
||||||
AsciiBytes hash = data.getComment().substring(UNPACK_MARKER.length());
|
|
||||||
String name = data.getName().toString();
|
String name = data.getName().toString();
|
||||||
if (name.lastIndexOf("/") != -1) {
|
if (name.lastIndexOf("/") != -1) {
|
||||||
name = name.substring(name.lastIndexOf("/") + 1);
|
name = name.substring(name.lastIndexOf("/") + 1);
|
||||||
}
|
}
|
||||||
File file = new File(getTempUnpackFolder(), hash.toString() + "-" + name);
|
File file = new File(getTempUnpackFolder(), name);
|
||||||
if (!file.exists() || file.length() != data.getSize()) {
|
if (!file.exists() || file.length() != data.getSize()) {
|
||||||
unpack(data, file);
|
unpack(data, file);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public class JarFileArchiveTests {
|
|||||||
Entry entry = getEntriesMap(this.archive).get("nested.jar");
|
Entry entry = getEntriesMap(this.archive).get("nested.jar");
|
||||||
Archive nested = this.archive.getNestedArchive(entry);
|
Archive nested = this.archive.getNestedArchive(entry);
|
||||||
assertThat(nested.getUrl().toString(), startsWith("file:"));
|
assertThat(nested.getUrl().toString(), startsWith("file:"));
|
||||||
assertThat(nested.getUrl().toString(), endsWith(".jar"));
|
assertThat(nested.getUrl().toString(), endsWith("/nested.jar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user