From efdf95b44b232a3c0192bd58b5c427e476fb3736 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 21 Oct 2026 17:42:21 +0000 Subject: [PATCH] Simplify failedPatch count --- server/homebrew.api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index aa1f1f84a..cc27eeca2 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -406,9 +406,9 @@ const api = { const patches = parsePatch(brewFromClient.patches); // Patch to a throwaway variable while parallelizing - we're more concerned with error/no error. result = applyPatches(patches, encodeURI(brewFromServer.text)); - const failedPatches = patches.map((patch, index)=>{if(!result[1][index]){ return patch; }}); - if(failedPatches > 0){ - throw (`Patch failure: ${failedPatches}/${result[1].length} did not apply`); + const failedPatchCount = result[1].filter((patchApplied)=>!patchApplied).length; //Count how many patches failed to apply + if(failedPatchCount){ + throw (`Patch failure: ${failedPatchCount}/${result[1].length} did not apply`); } if(decodeURI(result[0]) != brewFromClient.text){ throw ('Patches did not apply cleanly, text mismatch detected');