From 98559d7b29f6e1e2669a47f3f8ae00cd772321c3 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Mon, 10 Jun 2024 17:35:27 +0530 Subject: [PATCH] chore: update regex for sonar hotspot for map with json path --- src/v0/util/mapWithJSONPath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v0/util/mapWithJSONPath.js b/src/v0/util/mapWithJSONPath.js index 058ed8900a..7265eb2c85 100644 --- a/src/v0/util/mapWithJSONPath.js +++ b/src/v0/util/mapWithJSONPath.js @@ -4,7 +4,7 @@ const jsonpath = require('rs-jsonpath'); function mapWithJsonPath(message, targetObject, sourcePath, targetPath) { const values = jsonpath.query(message, sourcePath); const matchTargetPath = targetPath.split('$.events[0].')[1] || targetPath; - const regexMatch = /\[([^\n\]]+)]/; + const regexMatch = /\[[^\n\]]*]/; if (regexMatch.test(sourcePath) && regexMatch.test(matchTargetPath)) { // both paths are arrays // eslint-disable-next-line unicorn/no-for-loop