Skip to content

Commit

Permalink
do not throw errors for unknown compression methods when `passThrough…
Browse files Browse the repository at this point in the history
…` is set to `true`
  • Loading branch information
gildas-lormeau committed Aug 27, 2024
1 parent 977faf8 commit 75e3f95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/core/zip-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,15 @@ class ZipEntry {
const dataView = getDataView(dataArray);
let password = getOptionValue(zipEntry, options, "password");
let rawPassword = getOptionValue(zipEntry, options, "rawPassword");
const passThrough = getOptionValue(zipEntry, options, "passThrough");
password = password && password.length && password;
rawPassword = rawPassword && rawPassword.length && rawPassword;
if (extraFieldAES) {
if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
}
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) {
if ((compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) && !passThrough) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
Expand All @@ -429,7 +430,6 @@ class ZipEntry {
lastAccessDate: localDirectory.lastAccessDate,
creationDate: localDirectory.creationDate
});
const passThrough = getOptionValue(zipEntry, options, "passThrough");
const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
const zipCrypto = encrypted && !extraFieldAES;
if (!passThrough) {
Expand Down

0 comments on commit 75e3f95

Please sign in to comment.