PatchHelper: Prevent trailing comma error (#2913)

This commit is contained in:
sadan4 2024-11-07 13:23:03 -05:00 committed by GitHub
parent 5f7a2c59c6
commit 64c3dd1c16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -247,7 +247,7 @@ function FullPatchInput({ setFind, setParsedFind, setMatch, setReplacement }: Fu
} }
try { try {
const parsed = (0, eval)(`(${fullPatch})`) as Patch; const parsed = (0, eval)(`([${fullPatch}][0])`) as Patch;
if (!parsed.find) throw new Error("No 'find' field"); if (!parsed.find) throw new Error("No 'find' field");
if (!parsed.replacement) throw new Error("No 'replacement' field"); if (!parsed.replacement) throw new Error("No 'replacement' field");