fix: API middleware wrapper triggers on JSZip stream (#8683)

This commit is contained in:
Tom Moor
2025-03-12 20:50:41 -04:00
committed by GitHub
parent 6ea4ce72ec
commit 5a1aeed989

View File

@ -11,7 +11,10 @@ export default function apiResponse() {
typeof ctx.body === "object" &&
!(ctx.body instanceof Readable) &&
!(ctx.body instanceof stream.Readable) &&
!(ctx.body instanceof Buffer)
!(ctx.body instanceof Buffer) &&
// JSZip returns a wrapped stream instance that is not a true readable stream
// and not exported from the module either, so we must identify it like so.
!(ctx.body && "_readableState" in ctx.body)
) {
ctx.body = {
...ctx.body,