From b437ccde2fee407b8709106f38b28a13ff1da2c7 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 13 Jun 2023 19:21:12 -0700 Subject: [PATCH] Another attempt to catch zlib decompression errors --- src/utils/proxy/http.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/utils/proxy/http.js b/src/utils/proxy/http.js index 3c6374277..72f65be3b 100644 --- a/src/utils/proxy/http.js +++ b/src/utils/proxy/http.js @@ -33,15 +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(); + // zlib errors + responseContent.on("error", (e) => { + logger.error(e); + responseContent = response; // fallback + }); response.pipe(responseContent); }