From 7a1869d30cf7020953ee2c3e244020c6b7fb283c Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 15 Jun 2022 20:43:32 +1000 Subject: [PATCH] Fix sanitization for array case - was missing a return value (#3199) (cherry picked from commit c05ae111d08688438af3733bade4596954180c65) --- InvenTree/InvenTree/static/script/inventree/inventree.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index 92239cec86..32e94c1a24 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -278,7 +278,7 @@ function loadBrandIcon(element, name) { /* * Function to sanitize a (potentially nested) object. * Iterates through all levels, and sanitizes each primitive string. - * + * * Note that this function effectively provides a "deep copy" of the provided data, * and the original data structure is unaltered. */ @@ -287,10 +287,12 @@ function sanitizeData(data) { return null; } else if (Array.isArray(data)) { // Handle arrays - var ret = []; + var arr = []; data.forEach(function(val) { - ret.push(sanitizeData(val)); + arr.push(sanitizeData(val)); }); + + return arr; } else if (typeof(data) === 'object') { // Handle nested structures var nested = {};