From 266d846012db518679adaa2aaf53eb58fbec2c14 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 24 Nov 2022 18:28:02 +0100 Subject: [PATCH] pass correct key to sanitize callback --- backend/src/helpers/walkRecursive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/helpers/walkRecursive.js b/backend/src/helpers/walkRecursive.js index c65d3aa2c..26a3a01b2 100644 --- a/backend/src/helpers/walkRecursive.js +++ b/backend/src/helpers/walkRecursive.js @@ -12,7 +12,7 @@ function walkRecursive(data, fields, fieldName, callback, _key) { if (data && typeof data === 'string' && fields.includes(_key)) { // well we found what we searched for, lets replace the value with our callback result const key = _key.split('!') - if (key.length === 1 || key[1] !== fieldName) data = callback(data, _key) + if (key.length === 1 || key[1] !== fieldName) data = callback(data, key[0]) } else if (data && Array.isArray(data)) { // go into the rabbit hole and dig through that array data.forEach((res, index) => {