mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix sanitization for array case - was missing a return value (#3199)
(cherry picked from commit c05ae111d0
)
This commit is contained in:
parent
cd418d6948
commit
7a1869d30c
@ -278,7 +278,7 @@ function loadBrandIcon(element, name) {
|
|||||||
/*
|
/*
|
||||||
* Function to sanitize a (potentially nested) object.
|
* Function to sanitize a (potentially nested) object.
|
||||||
* Iterates through all levels, and sanitizes each primitive string.
|
* Iterates through all levels, and sanitizes each primitive string.
|
||||||
*
|
*
|
||||||
* Note that this function effectively provides a "deep copy" of the provided data,
|
* Note that this function effectively provides a "deep copy" of the provided data,
|
||||||
* and the original data structure is unaltered.
|
* and the original data structure is unaltered.
|
||||||
*/
|
*/
|
||||||
@ -287,10 +287,12 @@ function sanitizeData(data) {
|
|||||||
return null;
|
return null;
|
||||||
} else if (Array.isArray(data)) {
|
} else if (Array.isArray(data)) {
|
||||||
// Handle arrays
|
// Handle arrays
|
||||||
var ret = [];
|
var arr = [];
|
||||||
data.forEach(function(val) {
|
data.forEach(function(val) {
|
||||||
ret.push(sanitizeData(val));
|
arr.push(sanitizeData(val));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return arr;
|
||||||
} else if (typeof(data) === 'object') {
|
} else if (typeof(data) === 'object') {
|
||||||
// Handle nested structures
|
// Handle nested structures
|
||||||
var nested = {};
|
var nested = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user