@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/dist/zip-fs-core.js
CHANGED
|
@@ -6023,32 +6023,19 @@
|
|
|
6023
6023
|
}) {
|
|
6024
6024
|
let dataDescriptorLength = 0;
|
|
6025
6025
|
if (dataDescriptor) {
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
} else {
|
|
6029
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6030
|
-
}
|
|
6031
|
-
}
|
|
6032
|
-
if (dataDescriptorLength) {
|
|
6033
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6026
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6027
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6034
6028
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6042
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6043
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6044
|
-
} else {
|
|
6045
|
-
signature = false;
|
|
6046
|
-
}
|
|
6047
|
-
}
|
|
6048
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6049
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6050
|
-
localDataDescriptor.signature = signature;
|
|
6029
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6030
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6031
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6032
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6033
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6034
|
+
if (localDataDescriptor) {
|
|
6051
6035
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6036
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6037
|
+
} else {
|
|
6038
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6052
6039
|
}
|
|
6053
6040
|
}
|
|
6054
6041
|
const range = {
|
|
@@ -6113,18 +6100,31 @@
|
|
|
6113
6100
|
return mergedRanges;
|
|
6114
6101
|
}
|
|
6115
6102
|
|
|
6116
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6103
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6104
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6105
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6106
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6107
|
+
return UNDEFINED_VALUE;
|
|
6108
|
+
}
|
|
6117
6109
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6118
6110
|
let compressedSize;
|
|
6119
6111
|
let uncompressedSize;
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6112
|
+
try {
|
|
6113
|
+
if (zip64) {
|
|
6114
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6115
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6116
|
+
} else {
|
|
6117
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6118
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6119
|
+
}
|
|
6120
|
+
} catch {
|
|
6121
|
+
return UNDEFINED_VALUE;
|
|
6126
6122
|
}
|
|
6127
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6123
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6124
|
+
}
|
|
6125
|
+
|
|
6126
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6127
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6128
6128
|
}
|
|
6129
6129
|
|
|
6130
6130
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9045,7 +9045,7 @@
|
|
|
9045
9045
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9046
9046
|
*/
|
|
9047
9047
|
|
|
9048
|
-
const VERSION = "2.18.
|
|
9048
|
+
const VERSION = "2.18.2";
|
|
9049
9049
|
|
|
9050
9050
|
/*
|
|
9051
9051
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|