@zip.js/zip.js 2.18.0 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist/zip-core-external.js +39 -31
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +39 -31
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +39 -31
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +39 -31
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +39 -31
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +39 -31
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +39 -31
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +39 -31
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +39 -31
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +39 -31
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +39 -31
- package/index-native.min.js +1 -1
- package/index.cjs +39 -31
- package/index.d.cts +12 -0
- package/index.d.ts +12 -0
- package/index.min.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/zip-reader.js +38 -30
- package/package.json +1 -1
package/dist/zip-fs-external.js
CHANGED
|
@@ -6058,32 +6058,27 @@ async function detectOverlappingEntry({
|
|
|
6058
6058
|
}) {
|
|
6059
6059
|
let dataDescriptorLength = 0;
|
|
6060
6060
|
if (dataDescriptor) {
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
} else {
|
|
6064
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6065
|
-
}
|
|
6066
|
-
}
|
|
6067
|
-
if (dataDescriptorLength) {
|
|
6068
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6061
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6062
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6069
6063
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
const
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6079
|
-
} else {
|
|
6080
|
-
signature = false;
|
|
6064
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6065
|
+
let localDataDescriptor;
|
|
6066
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6067
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6068
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6069
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6070
|
+
localDataDescriptor = candidate;
|
|
6071
|
+
break;
|
|
6081
6072
|
}
|
|
6082
6073
|
}
|
|
6083
|
-
if (
|
|
6084
|
-
|
|
6085
|
-
|
|
6074
|
+
if (!localDataDescriptor) {
|
|
6075
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6076
|
+
}
|
|
6077
|
+
if (localDataDescriptor) {
|
|
6086
6078
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6079
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6080
|
+
} else {
|
|
6081
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6087
6082
|
}
|
|
6088
6083
|
}
|
|
6089
6084
|
const range = {
|
|
@@ -6148,18 +6143,31 @@ function mergeRanges(sortedRanges, pendingRanges) {
|
|
|
6148
6143
|
return mergedRanges;
|
|
6149
6144
|
}
|
|
6150
6145
|
|
|
6151
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6146
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6147
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6148
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6149
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6150
|
+
return UNDEFINED_VALUE;
|
|
6151
|
+
}
|
|
6152
6152
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6153
6153
|
let compressedSize;
|
|
6154
6154
|
let uncompressedSize;
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6155
|
+
try {
|
|
6156
|
+
if (zip64) {
|
|
6157
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6158
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6159
|
+
} else {
|
|
6160
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6161
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6162
|
+
}
|
|
6163
|
+
} catch {
|
|
6164
|
+
return UNDEFINED_VALUE;
|
|
6161
6165
|
}
|
|
6162
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6166
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6167
|
+
}
|
|
6168
|
+
|
|
6169
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6170
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6163
6171
|
}
|
|
6164
6172
|
|
|
6165
6173
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9080,7 +9088,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9080
9088
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9081
9089
|
*/
|
|
9082
9090
|
|
|
9083
|
-
const VERSION = "2.18.
|
|
9091
|
+
const VERSION = "2.18.1";
|
|
9084
9092
|
|
|
9085
9093
|
/*
|
|
9086
9094
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|