From abcea88d0a0381db7aaedcd5aaa2444560967df6 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 13 Jun 2023 15:23:19 -0700 Subject: [PATCH] Try to handle zlib errors --- src/utils/proxy/http.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/proxy/http.js b/src/utils/proxy/http.js index f869cd0bd..3c6374277 100644 --- a/src/utils/proxy/http.js +++ b/src/utils/proxy/http.js @@ -33,6 +33,13 @@ function handleRequest(requestor, url, params) { const contentEncoding = response.headers['content-encoding']?.trim().toLowerCase(); let responseContent = response; + + // zlib errors + responseContent.on("error", (e) => { + logger.error(e); + responseContent = response; // fallback + }); + if (contentEncoding === 'gzip' || contentEncoding === 'deflate') { responseContent = createUnzip(); response.pipe(responseContent);