@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/index-native.cjs
CHANGED
|
@@ -6019,32 +6019,27 @@ 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
|
-
const
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6040
|
-
} else {
|
|
6041
|
-
signature = false;
|
|
6025
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6026
|
+
let localDataDescriptor;
|
|
6027
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6028
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6029
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6030
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6031
|
+
localDataDescriptor = candidate;
|
|
6032
|
+
break;
|
|
6042
6033
|
}
|
|
6043
6034
|
}
|
|
6044
|
-
if (
|
|
6045
|
-
|
|
6046
|
-
|
|
6035
|
+
if (!localDataDescriptor) {
|
|
6036
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6037
|
+
}
|
|
6038
|
+
if (localDataDescriptor) {
|
|
6047
6039
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6040
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6041
|
+
} else {
|
|
6042
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6048
6043
|
}
|
|
6049
6044
|
}
|
|
6050
6045
|
const range = {
|
|
@@ -6109,18 +6104,31 @@ function mergeRanges(sortedRanges, pendingRanges) {
|
|
|
6109
6104
|
return mergedRanges;
|
|
6110
6105
|
}
|
|
6111
6106
|
|
|
6112
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6107
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6108
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6109
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6110
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6111
|
+
return UNDEFINED_VALUE;
|
|
6112
|
+
}
|
|
6113
6113
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6114
6114
|
let compressedSize;
|
|
6115
6115
|
let uncompressedSize;
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6116
|
+
try {
|
|
6117
|
+
if (zip64) {
|
|
6118
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6119
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6120
|
+
} else {
|
|
6121
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6122
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6123
|
+
}
|
|
6124
|
+
} catch {
|
|
6125
|
+
return UNDEFINED_VALUE;
|
|
6122
6126
|
}
|
|
6123
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6127
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6131
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6124
6132
|
}
|
|
6125
6133
|
|
|
6126
6134
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9041,7 +9049,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9041
9049
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9042
9050
|
*/
|
|
9043
9051
|
|
|
9044
|
-
const VERSION = "2.18.
|
|
9052
|
+
const VERSION = "2.18.1";
|
|
9045
9053
|
|
|
9046
9054
|
/*
|
|
9047
9055
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|