From ea41769e59309e7924a7589cdc6e3b57fefa4006 Mon Sep 17 00:00:00 2001 From: Shahar Talmi Date: Mon, 2 Dec 2024 12:24:18 +0200 Subject: [PATCH 1/2] Fix code scanning alert no. 3: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/2018/day02.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/2018/day02.js b/src/2018/day02.js index da34060b..9b63890e 100644 --- a/src/2018/day02.js +++ b/src/2018/day02.js @@ -25,7 +25,7 @@ export function part2(input) { for (let i = 0; i < arr.length; i++) { const without = arr.map((x, index) => (index === i ? "*" : x)).join(""); if (memory.has(without)) { - return without.replace("*", ""); + return without.replace(/\*/g, ""); } else { memory.add(without); } From 48fef63fc0b393e7d2360e70992e59c6dca84d0a Mon Sep 17 00:00:00 2001 From: Shahar Talmi Date: Mon, 2 Dec 2024 15:38:49 +0200 Subject: [PATCH 2/2] Update day02.js --- src/2018/day02.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/2018/day02.js b/src/2018/day02.js index 9b63890e..20e24918 100644 --- a/src/2018/day02.js +++ b/src/2018/day02.js @@ -25,7 +25,7 @@ export function part2(input) { for (let i = 0; i < arr.length; i++) { const without = arr.map((x, index) => (index === i ? "*" : x)).join(""); if (memory.has(without)) { - return without.replace(/\*/g, ""); + return without.replace(/\*/, ""); } else { memory.add(without); }