From 4a88695563ced73e18a97be06f9f0864be683eff Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Tue, 12 Mar 2024 17:23:31 +0530 Subject: fix(ext/node): flush brotli decompression stream (#22856) Fixes https://github.com/denoland/deno/issues/22259 The decompressed input size was not restored because of improper flushing of the CBrotliDecompressStream state. --- tests/unit_node/zlib_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/unit_node/zlib_test.ts b/tests/unit_node/zlib_test.ts index 94b1c63ca..fa09bd687 100644 --- a/tests/unit_node/zlib_test.ts +++ b/tests/unit_node/zlib_test.ts @@ -171,3 +171,13 @@ Deno.test("brotli large chunk size", async () => { ); assertEquals(output.length, input.length); }); + +Deno.test("brotli decompress flush restore size", async () => { + const input = new Uint8Array(1000000); + const output = await buffer( + Readable.from([input]) + .pipe(createBrotliCompress()) + .pipe(createBrotliDecompress()), + ); + assertEquals(output.length, input.length); +}); -- cgit v1.2.3