Skip to content

Commit

Permalink
ignore password if the entry is not encrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Jul 14, 2022
1 parent 36a68bc commit ac3b092
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/core/streams/zip-entry-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ class DeflateStream extends TransformStream {

constructor(codecConstructor, options, { chunkSize }, ...strategies) {
super({}, ...strategies);
const { compressed, useCompressionStream, password, passwordVerification, encryptionStrength, zipCrypto, signed } = options;
const { compressed, encrypted, useCompressionStream, password, passwordVerification, encryptionStrength, zipCrypto, signed } = options;
const stream = this;
let crc32Stream, encryptionStream;
let readable = filterEmptyChunks(super.readable);
const encrypted = Boolean(password);
if ((!encrypted || zipCrypto) && signed) {
[readable, crc32Stream] = readable.tee();
crc32Stream = crc32Stream.pipeThrough(new Crc32Stream());
Expand Down Expand Up @@ -99,11 +98,10 @@ class InflateStream extends TransformStream {

constructor(codecConstructor, options, { chunkSize }, ...strategies) {
super({}, ...strategies);
const { zipCrypto, password, passwordVerification, signed, encryptionStrength, compressed, useCompressionStream } = options;
const { zipCrypto, encrypted, password, passwordVerification, signed, encryptionStrength, compressed, useCompressionStream } = options;
const stream = this;
let crc32Stream, decryptionStream;
let readable = filterEmptyChunks(super.readable);
const encrypted = Boolean(password);
if (encrypted) {
if (zipCrypto) {
readable = readable.pipeThrough(new ZipCryptoDecryptionStream(password, passwordVerification));
Expand Down

0 comments on commit ac3b092

Please sign in to comment.