Don't duplicate META-INF entries in nested directory jars
Update `ZipContent` so that `META-INF` entries are no longer duplicated in nested jars created from directory entries. This aligns with the behavior of the classic loader and prevents the same META-INF file from being discovered twice. Fixes gh-38862
This commit is contained in:
@@ -637,10 +637,7 @@ public final class ZipContent implements Closeable {
|
||||
.load(zip.data, pos);
|
||||
long namePos = pos + ZipCentralDirectoryFileHeaderRecord.FILE_NAME_OFFSET;
|
||||
short nameLen = centralRecord.fileNameLength();
|
||||
if (ZipString.startsWith(loader.buffer, zip.data, namePos, nameLen, META_INF) != -1) {
|
||||
loader.add(centralRecord, pos, false);
|
||||
}
|
||||
else if (ZipString.startsWith(loader.buffer, zip.data, namePos, nameLen, directoryName) != -1) {
|
||||
if (ZipString.startsWith(loader.buffer, zip.data, namePos, nameLen, directoryName) != -1) {
|
||||
loader.add(centralRecord, pos, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user