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

This commit is contained in:
Tom Moor authored and GitHub committed 2025-03-13 00:50:41 +00:00
1 parent 6ea4ce72ec
commit 5a1aeed989
1 file changed
+4 -1
+4 -1
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,