@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-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) {
|
|
@@ -4818,7 +4823,7 @@
|
|
|
4818
4823
|
const CHARSET_UTF8 = "utf-8";
|
|
4819
4824
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4820
4825
|
const CHARSET_CP437 = "cp437";
|
|
4821
|
-
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4826
|
+
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_STRONG_ENCRYPTION | BITFLAG_LANG_ENCODING_FLAG;
|
|
4822
4827
|
const VENDOR_VERSION_AE_1$1 = 1;
|
|
4823
4828
|
const ZIP64_PROPERTIES = [
|
|
4824
4829
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -5472,12 +5477,12 @@
|
|
|
5472
5477
|
fileEntry.gid = gid;
|
|
5473
5478
|
}
|
|
5474
5479
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5475
|
-
const encrypted = zipEntry.encrypted &&
|
|
5480
|
+
const encrypted = zipEntry.encrypted && (!passThroughEncryption || checkPasswordOnly);
|
|
5476
5481
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
5477
5482
|
if (!passThroughEncryption) {
|
|
5478
5483
|
fileEntry.zipCrypto = zipCrypto;
|
|
5479
5484
|
}
|
|
5480
|
-
if (encrypted && (
|
|
5485
|
+
if (encrypted && (zipEntry.rawBitFlag & BITFLAG_STRONG_ENCRYPTION) == BITFLAG_STRONG_ENCRYPTION) {
|
|
5481
5486
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
5482
5487
|
}
|
|
5483
5488
|
const registeredCodec = passThroughCompression ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -5717,8 +5722,16 @@
|
|
|
5717
5722
|
});
|
|
5718
5723
|
const extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);
|
|
5719
5724
|
if (extraFieldZip64) {
|
|
5720
|
-
readExtraFieldZip64(extraFieldZip64, directory)
|
|
5725
|
+
if (!readExtraFieldZip64(extraFieldZip64, directory, localDirectory)) {
|
|
5726
|
+
malformedExtraField = true;
|
|
5727
|
+
}
|
|
5721
5728
|
directory.extraFieldZip64 = extraFieldZip64;
|
|
5729
|
+
} else if (ZIP64_PROPERTIES.some(([propertyName, max]) => directory[propertyName] == max)) {
|
|
5730
|
+
if (localDirectory) {
|
|
5731
|
+
malformedExtraField = true;
|
|
5732
|
+
} else {
|
|
5733
|
+
throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
|
|
5734
|
+
}
|
|
5722
5735
|
}
|
|
5723
5736
|
const extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);
|
|
5724
5737
|
if (extraFieldUnicodePath) {
|
|
@@ -5731,10 +5744,13 @@
|
|
|
5731
5744
|
directory.extraFieldUnicodeComment = extraFieldUnicodeComment;
|
|
5732
5745
|
}
|
|
5733
5746
|
const extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);
|
|
5734
|
-
if (extraFieldAES && extraFieldAES.data.length >= 7) {
|
|
5747
|
+
if (extraFieldAES && (compressionMethod == COMPRESSION_METHOD_AES || directory.encrypted) && extraFieldAES.data.length >= 7) {
|
|
5735
5748
|
readExtraFieldAES(extraFieldAES, directory, compressionMethod);
|
|
5736
5749
|
directory.extraFieldAES = extraFieldAES;
|
|
5737
5750
|
} else {
|
|
5751
|
+
if (extraFieldAES) {
|
|
5752
|
+
malformedExtraField = true;
|
|
5753
|
+
}
|
|
5738
5754
|
directory.compressionMethod = compressionMethod;
|
|
5739
5755
|
}
|
|
5740
5756
|
const extraFieldPkwareUnix = extraField.get(EXTRAFIELD_TYPE_PKWARE_UNIX);
|
|
@@ -5777,20 +5793,35 @@
|
|
|
5777
5793
|
return malformedExtraField;
|
|
5778
5794
|
}
|
|
5779
5795
|
|
|
5780
|
-
function readExtraFieldZip64(extraFieldZip64, directory) {
|
|
5796
|
+
function readExtraFieldZip64(extraFieldZip64, directory, localDirectory) {
|
|
5781
5797
|
directory.zip64 = true;
|
|
5782
5798
|
const extraFieldView = getDataView(extraFieldZip64.data);
|
|
5783
5799
|
const missingProperties = ZIP64_PROPERTIES.filter(([propertyName, max]) => directory[propertyName] == max);
|
|
5784
5800
|
const requiredLength = missingProperties.reduce((length, [, max]) => length + ZIP64_EXTRACTION[max].bytes, 0);
|
|
5785
5801
|
if (extraFieldZip64.data.length < requiredLength) {
|
|
5802
|
+
if (localDirectory) {
|
|
5803
|
+
return false;
|
|
5804
|
+
}
|
|
5786
5805
|
throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
|
|
5787
5806
|
}
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5807
|
+
const values = [];
|
|
5808
|
+
try {
|
|
5809
|
+
for (let indexMissingProperty = 0, offset = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) {
|
|
5810
|
+
const [, max] = missingProperties[indexMissingProperty];
|
|
5811
|
+
const extraction = ZIP64_EXTRACTION[max];
|
|
5812
|
+
values.push(extraction.getValue(extraFieldView, offset));
|
|
5813
|
+
offset += extraction.bytes;
|
|
5814
|
+
}
|
|
5815
|
+
} catch (error) {
|
|
5816
|
+
if (localDirectory) {
|
|
5817
|
+
return false;
|
|
5818
|
+
}
|
|
5819
|
+
throw error;
|
|
5793
5820
|
}
|
|
5821
|
+
missingProperties.forEach(([propertyName], indexMissingProperty) => {
|
|
5822
|
+
directory[propertyName] = extraFieldZip64[propertyName] = values[indexMissingProperty];
|
|
5823
|
+
});
|
|
5824
|
+
return true;
|
|
5794
5825
|
}
|
|
5795
5826
|
|
|
5796
5827
|
function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
|
|
@@ -8896,7 +8927,7 @@
|
|
|
8896
8927
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8897
8928
|
*/
|
|
8898
8929
|
|
|
8899
|
-
const VERSION = "2.
|
|
8930
|
+
const VERSION = "2.18.0";
|
|
8900
8931
|
|
|
8901
8932
|
/*
|
|
8902
8933
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|