@zip.js/zip.js 2.17.0 → 2.18.0
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 +45 -14
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +45 -14
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +45 -14
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +45 -14
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +45 -14
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +47 -16
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +46 -15
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +47 -16
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +47 -16
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +46 -15
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +47 -16
- package/index-native.min.js +1 -1
- package/index.cjs +46 -15
- package/index.d.cts +37 -12
- package/index.d.ts +37 -12
- package/index.min.js +1 -1
- package/lib/core/codec-worker-web.js +7 -2
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +1 -1
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-reader.js +37 -11
- package/package.json +1 -1
package/dist/zip-fs-core.js
CHANGED
|
@@ -3245,8 +3245,13 @@
|
|
|
3245
3245
|
if (codecImportFailed) {
|
|
3246
3246
|
responseError.codecImportFailed = true;
|
|
3247
3247
|
}
|
|
3248
|
-
if (cause
|
|
3249
|
-
|
|
3248
|
+
if (cause) {
|
|
3249
|
+
if (!isErrorObject(responseError.cause)) {
|
|
3250
|
+
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3251
|
+
}
|
|
3252
|
+
if (cause.code !== UNDEFINED_VALUE && responseError.cause.code !== cause.code) {
|
|
3253
|
+
responseError.cause.code = cause.code;
|
|
3254
|
+
}
|
|
3250
3255
|
}
|
|
3251
3256
|
if (errorValue) {
|
|
3252
3257
|
if (responseError.name !== name) {
|
|
@@ -4838,7 +4843,7 @@
|
|
|
4838
4843
|
const CHARSET_UTF8 = "utf-8";
|
|
4839
4844
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4840
4845
|
const CHARSET_CP437 = "cp437";
|
|
4841
|
-
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4846
|
+
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_STRONG_ENCRYPTION | BITFLAG_LANG_ENCODING_FLAG;
|
|
4842
4847
|
const VENDOR_VERSION_AE_1$1 = 1;
|
|
4843
4848
|
const ZIP64_PROPERTIES = [
|
|
4844
4849
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -5492,12 +5497,12 @@
|
|
|
5492
5497
|
fileEntry.gid = gid;
|
|
5493
5498
|
}
|
|
5494
5499
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5495
|
-
const encrypted = zipEntry.encrypted &&
|
|
5500
|
+
const encrypted = zipEntry.encrypted && (!passThroughEncryption || checkPasswordOnly);
|
|
5496
5501
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
5497
5502
|
if (!passThroughEncryption) {
|
|
5498
5503
|
fileEntry.zipCrypto = zipCrypto;
|
|
5499
5504
|
}
|
|
5500
|
-
if (encrypted && (
|
|
5505
|
+
if (encrypted && (zipEntry.rawBitFlag & BITFLAG_STRONG_ENCRYPTION) == BITFLAG_STRONG_ENCRYPTION) {
|
|
5501
5506
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
5502
5507
|
}
|
|
5503
5508
|
const registeredCodec = passThroughCompression ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -5737,8 +5742,16 @@
|
|
|
5737
5742
|
});
|
|
5738
5743
|
const extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);
|
|
5739
5744
|
if (extraFieldZip64) {
|
|
5740
|
-
readExtraFieldZip64(extraFieldZip64, directory)
|
|
5745
|
+
if (!readExtraFieldZip64(extraFieldZip64, directory, localDirectory)) {
|
|
5746
|
+
malformedExtraField = true;
|
|
5747
|
+
}
|
|
5741
5748
|
directory.extraFieldZip64 = extraFieldZip64;
|
|
5749
|
+
} else if (ZIP64_PROPERTIES.some(([propertyName, max]) => directory[propertyName] == max)) {
|
|
5750
|
+
if (localDirectory) {
|
|
5751
|
+
malformedExtraField = true;
|
|
5752
|
+
} else {
|
|
5753
|
+
throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
|
|
5754
|
+
}
|
|
5742
5755
|
}
|
|
5743
5756
|
const extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);
|
|
5744
5757
|
if (extraFieldUnicodePath) {
|
|
@@ -5751,10 +5764,13 @@
|
|
|
5751
5764
|
directory.extraFieldUnicodeComment = extraFieldUnicodeComment;
|
|
5752
5765
|
}
|
|
5753
5766
|
const extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);
|
|
5754
|
-
if (extraFieldAES && extraFieldAES.data.length >= 7) {
|
|
5767
|
+
if (extraFieldAES && (compressionMethod == COMPRESSION_METHOD_AES || directory.encrypted) && extraFieldAES.data.length >= 7) {
|
|
5755
5768
|
readExtraFieldAES(extraFieldAES, directory, compressionMethod);
|
|
5756
5769
|
directory.extraFieldAES = extraFieldAES;
|
|
5757
5770
|
} else {
|
|
5771
|
+
if (extraFieldAES) {
|
|
5772
|
+
malformedExtraField = true;
|
|
5773
|
+
}
|
|
5758
5774
|
directory.compressionMethod = compressionMethod;
|
|
5759
5775
|
}
|
|
5760
5776
|
const extraFieldPkwareUnix = extraField.get(EXTRAFIELD_TYPE_PKWARE_UNIX);
|
|
@@ -5797,20 +5813,35 @@
|
|
|
5797
5813
|
return malformedExtraField;
|
|
5798
5814
|
}
|
|
5799
5815
|
|
|
5800
|
-
function readExtraFieldZip64(extraFieldZip64, directory) {
|
|
5816
|
+
function readExtraFieldZip64(extraFieldZip64, directory, localDirectory) {
|
|
5801
5817
|
directory.zip64 = true;
|
|
5802
5818
|
const extraFieldView = getDataView(extraFieldZip64.data);
|
|
5803
5819
|
const missingProperties = ZIP64_PROPERTIES.filter(([propertyName, max]) => directory[propertyName] == max);
|
|
5804
5820
|
const requiredLength = missingProperties.reduce((length, [, max]) => length + ZIP64_EXTRACTION[max].bytes, 0);
|
|
5805
5821
|
if (extraFieldZip64.data.length < requiredLength) {
|
|
5822
|
+
if (localDirectory) {
|
|
5823
|
+
return false;
|
|
5824
|
+
}
|
|
5806
5825
|
throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
|
|
5807
5826
|
}
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5827
|
+
const values = [];
|
|
5828
|
+
try {
|
|
5829
|
+
for (let indexMissingProperty = 0, offset = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) {
|
|
5830
|
+
const [, max] = missingProperties[indexMissingProperty];
|
|
5831
|
+
const extraction = ZIP64_EXTRACTION[max];
|
|
5832
|
+
values.push(extraction.getValue(extraFieldView, offset));
|
|
5833
|
+
offset += extraction.bytes;
|
|
5834
|
+
}
|
|
5835
|
+
} catch (error) {
|
|
5836
|
+
if (localDirectory) {
|
|
5837
|
+
return false;
|
|
5838
|
+
}
|
|
5839
|
+
throw error;
|
|
5813
5840
|
}
|
|
5841
|
+
missingProperties.forEach(([propertyName], indexMissingProperty) => {
|
|
5842
|
+
directory[propertyName] = extraFieldZip64[propertyName] = values[indexMissingProperty];
|
|
5843
|
+
});
|
|
5844
|
+
return true;
|
|
5814
5845
|
}
|
|
5815
5846
|
|
|
5816
5847
|
function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
|
|
@@ -9014,7 +9045,7 @@
|
|
|
9014
9045
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9015
9046
|
*/
|
|
9016
9047
|
|
|
9017
|
-
const VERSION = "2.
|
|
9048
|
+
const VERSION = "2.18.0";
|
|
9018
9049
|
|
|
9019
9050
|
/*
|
|
9020
9051
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|