@zip.js/zip.js 2.18.0 → 2.18.2
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 +33 -33
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +33 -33
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +33 -33
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +33 -33
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +33 -33
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +33 -33
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +33 -33
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +33 -33
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +33 -33
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +33 -33
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +33 -33
- package/index-native.min.js +1 -1
- package/index.cjs +33 -33
- package/index.d.cts +15 -2
- package/index.d.ts +15 -2
- package/index.min.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/zip-reader.js +32 -32
- package/package.json +1 -1
package/index-native.cjs
CHANGED
|
@@ -6019,32 +6019,19 @@ async function detectOverlappingEntry({
|
|
|
6019
6019
|
}) {
|
|
6020
6020
|
let dataDescriptorLength = 0;
|
|
6021
6021
|
if (dataDescriptor) {
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
} else {
|
|
6025
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6026
|
-
}
|
|
6027
|
-
}
|
|
6028
|
-
if (dataDescriptorLength) {
|
|
6029
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6022
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6023
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6030
6024
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6038
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6039
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6040
|
-
} else {
|
|
6041
|
-
signature = false;
|
|
6042
|
-
}
|
|
6043
|
-
}
|
|
6044
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6045
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6046
|
-
localDataDescriptor.signature = signature;
|
|
6025
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6026
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6027
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6028
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6029
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6030
|
+
if (localDataDescriptor) {
|
|
6047
6031
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6032
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6033
|
+
} else {
|
|
6034
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6048
6035
|
}
|
|
6049
6036
|
}
|
|
6050
6037
|
const range = {
|
|
@@ -6109,18 +6096,31 @@ function mergeRanges(sortedRanges, pendingRanges) {
|
|
|
6109
6096
|
return mergedRanges;
|
|
6110
6097
|
}
|
|
6111
6098
|
|
|
6112
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6099
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6100
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6101
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6102
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6103
|
+
return UNDEFINED_VALUE;
|
|
6104
|
+
}
|
|
6113
6105
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6114
6106
|
let compressedSize;
|
|
6115
6107
|
let uncompressedSize;
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6108
|
+
try {
|
|
6109
|
+
if (zip64) {
|
|
6110
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6111
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6112
|
+
} else {
|
|
6113
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6114
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6115
|
+
}
|
|
6116
|
+
} catch {
|
|
6117
|
+
return UNDEFINED_VALUE;
|
|
6122
6118
|
}
|
|
6123
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6119
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6122
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6123
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6124
6124
|
}
|
|
6125
6125
|
|
|
6126
6126
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9041,7 +9041,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9041
9041
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9042
9042
|
*/
|
|
9043
9043
|
|
|
9044
|
-
const VERSION = "2.18.
|
|
9044
|
+
const VERSION = "2.18.2";
|
|
9045
9045
|
|
|
9046
9046
|
/*
|
|
9047
9047
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|