@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/deno.json
CHANGED
|
@@ -6038,32 +6038,27 @@ async function detectOverlappingEntry({
|
|
|
6038
6038
|
}) {
|
|
6039
6039
|
let dataDescriptorLength = 0;
|
|
6040
6040
|
if (dataDescriptor) {
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
} else {
|
|
6044
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6045
|
-
}
|
|
6046
|
-
}
|
|
6047
|
-
if (dataDescriptorLength) {
|
|
6048
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6041
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6042
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6049
6043
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
const
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6059
|
-
} else {
|
|
6060
|
-
signature = false;
|
|
6044
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6045
|
+
let localDataDescriptor;
|
|
6046
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6047
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6048
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6049
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6050
|
+
localDataDescriptor = candidate;
|
|
6051
|
+
break;
|
|
6061
6052
|
}
|
|
6062
6053
|
}
|
|
6063
|
-
if (
|
|
6064
|
-
|
|
6065
|
-
|
|
6054
|
+
if (!localDataDescriptor) {
|
|
6055
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6056
|
+
}
|
|
6057
|
+
if (localDataDescriptor) {
|
|
6066
6058
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6059
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6060
|
+
} else {
|
|
6061
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6067
6062
|
}
|
|
6068
6063
|
}
|
|
6069
6064
|
const range = {
|
|
@@ -6128,18 +6123,31 @@ function mergeRanges(sortedRanges, pendingRanges) {
|
|
|
6128
6123
|
return mergedRanges;
|
|
6129
6124
|
}
|
|
6130
6125
|
|
|
6131
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6126
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6127
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6128
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6129
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6130
|
+
return UNDEFINED_VALUE;
|
|
6131
|
+
}
|
|
6132
6132
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6133
6133
|
let compressedSize;
|
|
6134
6134
|
let uncompressedSize;
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6135
|
+
try {
|
|
6136
|
+
if (zip64) {
|
|
6137
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6138
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6139
|
+
} else {
|
|
6140
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6141
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6142
|
+
}
|
|
6143
|
+
} catch {
|
|
6144
|
+
return UNDEFINED_VALUE;
|
|
6141
6145
|
}
|
|
6142
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6146
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6147
|
+
}
|
|
6148
|
+
|
|
6149
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6150
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6143
6151
|
}
|
|
6144
6152
|
|
|
6145
6153
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -8962,7 +8970,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8962
8970
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8963
8971
|
*/
|
|
8964
8972
|
|
|
8965
|
-
const VERSION = "2.18.
|
|
8973
|
+
const VERSION = "2.18.1";
|
|
8966
8974
|
|
|
8967
8975
|
/*
|
|
8968
8976
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|