0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

fix(ext/fetch): throw TypeError on non-Uint8Array chunk (#16262)

This commit is contained in:
Marcos Casagrande 2022-10-14 11:38:17 +02:00 committed by GitHub
parent 50c7b89369
commit 0d6dbc08be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -813,6 +813,12 @@
const { value: chunk, done } = await reader.read();
if (done) break;
if (!ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk)) {
throw new TypeError(
"Can't convert value to Uint8Array while consuming the stream",
);
}
ArrayPrototypePush(chunks, chunk);
totalLength += chunk.byteLength;
}

View file

@ -3003,6 +3003,8 @@
"response-static-error.any.worker.html": true,
"response-static-redirect.any.html": true,
"response-static-redirect.any.worker.html": true,
"response-stream-bad-chunk.any.html": true,
"response-stream-bad-chunk.any.worker.html": true,
"response-stream-disturbed-1.any.html": true,
"response-stream-disturbed-1.any.worker.html": true,
"response-stream-disturbed-2.any.html": true,