mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 06:57:57 +04:00
netifd: parse_bool() accepts JSON booleans and numbers
parse_bool() compared its argument with the strings "1", "true", "0" and "false" only. A service-injected wireless config arrives as JSON, so a value of true, false, 1 or 0 gave null. wireless.uc then read "mlo": true of such a wifi-iface as no MLO, and parse_attribute_list() dropped every boolean attribute that came as JSON. Accept true and 1 as true, and false and 0 as false. The result for the UCI strings stays the same. Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
1 parent
d9340555b1
commit
762c707df2
1 file changed
+4
@@ -12,9 +12,13 @@ export function parse_bool(val)
|
||||
switch (val) {
|
||||
case "1":
|
||||
case "true":
|
||||
case true:
|
||||
case 1:
|
||||
return true;
|
||||
case "0":
|
||||
case "false":
|
||||
case false:
|
||||
case 0:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user