Skip to content

Commit

Permalink
fix handling of compressionMethod option when set to 0 (fix #517)
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Dec 5, 2024
1 parent a397434 commit 6643721
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/core/zip-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,8 @@ function getHeaderInfo(options) {
extendedTimestamp,
encrypted
} = options;
const compressed = level !== 0 && !directory;
let { version, compressionMethod } = options;
const compressed = !directory && (level > 0 || (level === UNDEFINED_VALUE && compressionMethod !== 0));
let rawExtraFieldAES;
if (encrypted && !zipCrypto) {
rawExtraFieldAES = new Uint8Array(getLength(EXTRAFIELD_DATA_AES) + 2);
Expand Down
2 changes: 1 addition & 1 deletion tests/all/test-passthrough-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function test() {
zip.configure({ chunkSize: 128, useWebWorkers: true });
let blobWriter = new zip.BlobWriter("application/zip");
let zipWriter = new zip.ZipWriter(blobWriter);
await zipWriter.add(FILENAME, new zip.BlobReader(BLOB), { level: 0 });
await zipWriter.add(FILENAME, new zip.BlobReader(BLOB), { compressionMethod: 0 });
await zipWriter.close();
let zipReader = new zip.ZipReader(new zip.BlobReader(await blobWriter.getData()));
let entries = await zipReader.getEntries();
Expand Down

0 comments on commit 6643721

Please sign in to comment.