@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-legacy.js
CHANGED
|
@@ -6005,32 +6005,19 @@
|
|
|
6005
6005
|
}) {
|
|
6006
6006
|
let dataDescriptorLength = 0;
|
|
6007
6007
|
if (dataDescriptor) {
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
} else {
|
|
6011
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
if (dataDescriptorLength) {
|
|
6015
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6008
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6009
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6016
6010
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6024
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6025
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6026
|
-
} else {
|
|
6027
|
-
signature = false;
|
|
6028
|
-
}
|
|
6029
|
-
}
|
|
6030
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6031
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6032
|
-
localDataDescriptor.signature = signature;
|
|
6011
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6012
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6013
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6014
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6015
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6016
|
+
if (localDataDescriptor) {
|
|
6033
6017
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6018
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6019
|
+
} else {
|
|
6020
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6034
6021
|
}
|
|
6035
6022
|
}
|
|
6036
6023
|
const range = {
|
|
@@ -6095,18 +6082,31 @@
|
|
|
6095
6082
|
return mergedRanges;
|
|
6096
6083
|
}
|
|
6097
6084
|
|
|
6098
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6085
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6086
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6087
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6088
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6089
|
+
return UNDEFINED_VALUE;
|
|
6090
|
+
}
|
|
6099
6091
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6100
6092
|
let compressedSize;
|
|
6101
6093
|
let uncompressedSize;
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6094
|
+
try {
|
|
6095
|
+
if (zip64) {
|
|
6096
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6097
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6098
|
+
} else {
|
|
6099
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6100
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6101
|
+
}
|
|
6102
|
+
} catch {
|
|
6103
|
+
return UNDEFINED_VALUE;
|
|
6108
6104
|
}
|
|
6109
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6105
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6106
|
+
}
|
|
6107
|
+
|
|
6108
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6109
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6110
6110
|
}
|
|
6111
6111
|
|
|
6112
6112
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -8929,7 +8929,7 @@
|
|
|
8929
8929
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8930
8930
|
*/
|
|
8931
8931
|
|
|
8932
|
-
const VERSION = "2.18.
|
|
8932
|
+
const VERSION = "2.18.2";
|
|
8933
8933
|
|
|
8934
8934
|
/*
|
|
8935
8935
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|