From 5af00f0c1ddbb9f853653c37dbc7698cfb43ec51 Mon Sep 17 00:00:00 2001 From: Rafal Drozda Date: Sat, 19 Oct 2024 23:57:06 +0200 Subject: [PATCH] Fix code scanning alert no. 7: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index a309f21..e79d28c 100644 --- a/main.js +++ b/main.js @@ -253,7 +253,7 @@ class Wled extends utils.Adapter { if (!color_primary) return; this.log.debug('Primary color before split : ' + color_primary.val); try { - color_primary.val = color_primary.val.replace("[",""); + color_primary.val = color_primary.val.replace(/\[/g, ""); color_primary = color_primary.val.split(',').map(s => parseInt(s)); } catch (error) { if (!color_primary) return; @@ -264,7 +264,7 @@ class Wled extends utils.Adapter { if (!color_secondary) return; this.log.debug('Secondary color : ' + color_secondary.val); try { - color_secondary.val = color_secondary.val.replace("[",""); + color_secondary.val = color_secondary.val.replace(/\[/g, ""); color_secondary = color_secondary.val.split(',').map(s => parseInt(s)); } catch (error) { if (!color_secondary) return; @@ -275,7 +275,7 @@ class Wled extends utils.Adapter { if (!color_tertiary) return; this.log.debug('Tertiary color : ' + color_tertiary.val); try { - color_tertiary.val = color_tertiary.val.replace("[",""); + color_tertiary.val = color_tertiary.val.replace(/\[/g, ""); color_tertiary = color_tertiary.val.split(',').map(s => parseInt(s)); } catch (error) { if (!color_tertiary) return;