@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-external.js
CHANGED
|
@@ -3280,8 +3280,13 @@ function getResponseError(errorData, errorValue) {
|
|
|
3280
3280
|
if (codecImportFailed) {
|
|
3281
3281
|
responseError.codecImportFailed = true;
|
|
3282
3282
|
}
|
|
3283
|
-
if (cause
|
|
3284
|
-
|
|
3283
|
+
if (cause) {
|
|
3284
|
+
if (!isErrorObject(responseError.cause)) {
|
|
3285
|
+
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3286
|
+
}
|
|
3287
|
+
if (cause.code !== UNDEFINED_VALUE && responseError.cause.code !== cause.code) {
|
|
3288
|
+
responseError.cause.code = cause.code;
|
|
3289
|
+
}
|
|
3285
3290
|
}
|
|
3286
3291
|
if (errorValue) {
|
|
3287
3292
|
if (responseError.name !== name) {
|
|
@@ -4873,7 +4878,7 @@ const PARENT_DIRECTORY_REGEXP = /(^|[\\/])\.\.([\\/]|$)/;
|
|
|
4873
4878
|
const CHARSET_UTF8 = "utf-8";
|
|
4874
4879
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4875
4880
|
const CHARSET_CP437 = "cp437";
|
|
4876
|
-
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4881
|
+
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_STRONG_ENCRYPTION | BITFLAG_LANG_ENCODING_FLAG;
|
|
4877
4882
|
const VENDOR_VERSION_AE_1$1 = 1;
|
|
4878
4883
|
const ZIP64_PROPERTIES = [
|
|
4879
4884
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -5527,12 +5532,12 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5527
5532
|
fileEntry.gid = gid;
|
|
5528
5533
|
}
|
|
5529
5534
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5530
|
-
const encrypted = zipEntry.encrypted &&
|
|
5535
|
+
const encrypted = zipEntry.encrypted && (!passThroughEncryption || checkPasswordOnly);
|
|
5531
5536
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
5532
5537
|
if (!passThroughEncryption) {
|
|
5533
5538
|
fileEntry.zipCrypto = zipCrypto;
|
|
5534
5539
|
}
|
|
5535
|
-
if (encrypted && (
|
|
5540
|
+
if (encrypted && (zipEntry.rawBitFlag & BITFLAG_STRONG_ENCRYPTION) == BITFLAG_STRONG_ENCRYPTION) {
|
|
5536
5541
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
5537
5542
|
}
|
|
5538
5543
|
const registeredCodec = passThroughCompression ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -5772,8 +5777,16 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5772
5777
|
});
|
|
5773
5778
|
const extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);
|
|
5774
5779
|
if (extraFieldZip64) {
|
|
5775
|
-
readExtraFieldZip64(extraFieldZip64, directory)
|
|
5780
|
+
if (!readExtraFieldZip64(extraFieldZip64, directory, localDirectory)) {
|
|
5781
|
+
malformedExtraField = true;
|
|
5782
|
+
}
|
|
5776
5783
|
directory.extraFieldZip64 = extraFieldZip64;
|
|
5784
|
+
} else if (ZIP64_PROPERTIES.some(([propertyName, max]) => directory[propertyName] == max)) {
|
|
5785
|
+
if (localDirectory) {
|
|
5786
|
+
malformedExtraField = true;
|
|
5787
|
+
} else {
|
|
5788
|
+
throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
|
|
5789
|
+
}
|
|
5777
5790
|
}
|
|
5778
5791
|
const extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);
|
|
5779
5792
|
if (extraFieldUnicodePath) {
|
|
@@ -5786,10 +5799,13 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5786
5799
|
directory.extraFieldUnicodeComment = extraFieldUnicodeComment;
|
|
5787
5800
|
}
|
|
5788
5801
|
const extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);
|
|
5789
|
-
if (extraFieldAES && extraFieldAES.data.length >= 7) {
|
|
5802
|
+
if (extraFieldAES && (compressionMethod == COMPRESSION_METHOD_AES || directory.encrypted) && extraFieldAES.data.length >= 7) {
|
|
5790
5803
|
readExtraFieldAES(extraFieldAES, directory, compressionMethod);
|
|
5791
5804
|
directory.extraFieldAES = extraFieldAES;
|
|
5792
5805
|
} else {
|
|
5806
|
+
if (extraFieldAES) {
|
|
5807
|
+
malformedExtraField = true;
|
|
5808
|
+
}
|
|
5793
5809
|
directory.compressionMethod = compressionMethod;
|
|
5794
5810
|
}
|
|
5795
5811
|
const extraFieldPkwareUnix = extraField.get(EXTRAFIELD_TYPE_PKWARE_UNIX);
|
|
@@ -5832,20 +5848,35 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5832
5848
|
return malformedExtraField;
|
|
5833
5849
|
}
|
|
5834
5850
|
|
|
5835
|
-
function readExtraFieldZip64(extraFieldZip64, directory) {
|
|
5851
|
+
function readExtraFieldZip64(extraFieldZip64, directory, localDirectory) {
|
|
5836
5852
|
directory.zip64 = true;
|
|
5837
5853
|
const extraFieldView = getDataView(extraFieldZip64.data);
|
|
5838
5854
|
const missingProperties = ZIP64_PROPERTIES.filter(([propertyName, max]) => directory[propertyName] == max);
|
|
5839
5855
|
const requiredLength = missingProperties.reduce((length, [, max]) => length + ZIP64_EXTRACTION[max].bytes, 0);
|
|
5840
5856
|
if (extraFieldZip64.data.length < requiredLength) {
|
|
5857
|
+
if (localDirectory) {
|
|
5858
|
+
return false;
|
|
5859
|
+
}
|
|
5841
5860
|
throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
|
|
5842
5861
|
}
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5862
|
+
const values = [];
|
|
5863
|
+
try {
|
|
5864
|
+
for (let indexMissingProperty = 0, offset = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) {
|
|
5865
|
+
const [, max] = missingProperties[indexMissingProperty];
|
|
5866
|
+
const extraction = ZIP64_EXTRACTION[max];
|
|
5867
|
+
values.push(extraction.getValue(extraFieldView, offset));
|
|
5868
|
+
offset += extraction.bytes;
|
|
5869
|
+
}
|
|
5870
|
+
} catch (error) {
|
|
5871
|
+
if (localDirectory) {
|
|
5872
|
+
return false;
|
|
5873
|
+
}
|
|
5874
|
+
throw error;
|
|
5848
5875
|
}
|
|
5876
|
+
missingProperties.forEach(([propertyName], indexMissingProperty) => {
|
|
5877
|
+
directory[propertyName] = extraFieldZip64[propertyName] = values[indexMissingProperty];
|
|
5878
|
+
});
|
|
5879
|
+
return true;
|
|
5849
5880
|
}
|
|
5850
5881
|
|
|
5851
5882
|
function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
|
|
@@ -9049,7 +9080,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9049
9080
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9050
9081
|
*/
|
|
9051
9082
|
|
|
9052
|
-
const VERSION = "2.
|
|
9083
|
+
const VERSION = "2.18.0";
|
|
9053
9084
|
|
|
9054
9085
|
/*
|
|
9055
9086
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|