]> git.proxmox.com Git - pve-common.git/commitdiff
SectionConfig::check_value: return bool/numbers as numeric value
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 25 Feb 2017 08:37:18 +0000 (09:37 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 25 Feb 2017 08:41:17 +0000 (09:41 +0100)
This is important when we convert the result to JSON.
Else the GUI receives booleans as "0", which evaluate to true
in JS!

NOTE: "0" evaluates to false with perl.

src/PVE/SectionConfig.pm

index e489b7c6f4e14eadb3227bb1114d4d2d2124535f..b1e96a4ed42bd9625e0a53b1ec932d061ea1f053 100644 (file)
@@ -259,6 +259,10 @@ sub check_value {
        }
     }
 
+    if ($ct eq 'boolean' || $ct eq 'integer' || $ct eq 'number') {
+       return $value + 0; # convert to number
+    }
+
     return $value;
 }