Fix validation setting uci arrays (#1561)

This commit is contained in:
Tim Wilkinson 2024-09-22 16:58:09 -07:00 committed by GitHub
parent 4b0ba4625f
commit 5b80ae8adc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 2 deletions

View File

@ -196,7 +196,15 @@ const uciMethods =
cursor.set(a, b, c);
}
else {
cursor.set(a, b, c, replace(replace(d, "'", ""), /[\r\n]/g, " "));
if (type(d) === "array") {
for (let i = 0; i < length(d); i++) {
d[i] = replace(replace(d[i], /['<>]/g, ""), /[\r\n]/g, " ");
}
}
else {
d = replace(replace(d, /['<>]/g, ""), /[\r\n]/g, " ");
}
cursor.set(a, b, c, d);
}
},
@ -263,7 +271,15 @@ const uciMeshMethods =
cursorm.set(a, b, c);
}
else {
cursorm.set(a, b, c, replace(replace(d, /['<>]/g, ""), /[\r\n]/g, " "));
if (type(d) === "array") {
for (let i = 0; i < length(d); i++) {
d[i] = replace(replace(d[i], /['<>]/g, ""), /[\r\n]/g, " ");
}
}
else {
d = replace(replace(d, /['<>]/g, ""), /[\r\n]/g, " ");
}
cursorm.set(a, b, c, d);
}
},