From 5edea7d0f434d719c7d017fbbfa57430362488a7 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 13 Jul 2025 00:55:16 -0400 Subject: [PATCH] Turns out body-parser automatically inflates gzip. Can remove. --- server/homebrew.api.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index fb9c78ac8..b39f3575f 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -24,18 +24,6 @@ const isStaticTheme = (renderer, themeName)=>{ return Themes[renderer]?.[themeName] !== undefined; }; -const uncompressBrew = (input, encoding)=> { - try { - const jsonStr = encoding === 'gzip' - ? zlib.gunzipSync(input).toString('utf-8') - : input.toString('utf-8'); - - return JSON.parse(jsonStr); - } catch (err) { - throw new Error('Failed to parse JSON: ' + err.message); - } -} - // const getTopBrews = (cb) => { // HomebrewModel.find().sort({ views: -1 }).limit(5).exec(function(err, brews) { // cb(brews); @@ -349,7 +337,7 @@ const api = { }, updateBrew : async (req, res)=>{ // Initialize brew from request and body, destructure query params, and set the initial value for the after-save method - const brewFromClient = api.excludePropsFromUpdate(uncompressBrew(req.body, req.headers['content-encoding'])); + const brewFromClient = api.excludePropsFromUpdate(req.body); const brewFromServer = req.brew; splitTextStyleAndMetadata(brewFromServer);