@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.js
CHANGED
|
@@ -6013,32 +6013,19 @@
|
|
|
6013
6013
|
}) {
|
|
6014
6014
|
let dataDescriptorLength = 0;
|
|
6015
6015
|
if (dataDescriptor) {
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
} else {
|
|
6019
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6020
|
-
}
|
|
6021
|
-
}
|
|
6022
|
-
if (dataDescriptorLength) {
|
|
6023
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6016
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6017
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6024
6018
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6032
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6033
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6034
|
-
} else {
|
|
6035
|
-
signature = false;
|
|
6036
|
-
}
|
|
6037
|
-
}
|
|
6038
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6039
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6040
|
-
localDataDescriptor.signature = signature;
|
|
6019
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6020
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6021
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6022
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6023
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6024
|
+
if (localDataDescriptor) {
|
|
6041
6025
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6026
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6027
|
+
} else {
|
|
6028
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6042
6029
|
}
|
|
6043
6030
|
}
|
|
6044
6031
|
const range = {
|
|
@@ -6103,18 +6090,31 @@
|
|
|
6103
6090
|
return mergedRanges;
|
|
6104
6091
|
}
|
|
6105
6092
|
|
|
6106
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6093
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6094
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6095
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6096
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6097
|
+
return UNDEFINED_VALUE;
|
|
6098
|
+
}
|
|
6107
6099
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6108
6100
|
let compressedSize;
|
|
6109
6101
|
let uncompressedSize;
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6102
|
+
try {
|
|
6103
|
+
if (zip64) {
|
|
6104
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6105
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6106
|
+
} else {
|
|
6107
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6108
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6109
|
+
}
|
|
6110
|
+
} catch {
|
|
6111
|
+
return UNDEFINED_VALUE;
|
|
6116
6112
|
}
|
|
6117
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6113
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6114
|
+
}
|
|
6115
|
+
|
|
6116
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6117
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6118
6118
|
}
|
|
6119
6119
|
|
|
6120
6120
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -8937,7 +8937,7 @@
|
|
|
8937
8937
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8938
8938
|
*/
|
|
8939
8939
|
|
|
8940
|
-
const VERSION = "2.18.
|
|
8940
|
+
const VERSION = "2.18.2";
|
|
8941
8941
|
|
|
8942
8942
|
/*
|
|
8943
8943
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|