Perl's automatic conversion can lead to integers being converted to
strings, for example by matching it in a regex.
To make sure we always return an integer in the API call, add an
explicit cast to integer.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
foreach my $item (@$vollist) {
eval { PVE::Storage::check_volume_access($rpcenv, $authuser, $cfg, undef, $item->{volid}); };
next if $@;
foreach my $item (@$vollist) {
eval { PVE::Storage::check_volume_access($rpcenv, $authuser, $cfg, undef, $item->{volid}); };
next if $@;
- $item->{vmid} = int($item->{vmid}) if (defined($item->{vmid}));
+ $item->{vmid} = int($item->{vmid}) if defined($item->{vmid});
+ $item->{size} = int($item->{size}) if defined($item->{size});
+ $item->{used} = int($item->{used}) if defined($item->{used});
my $entry = {
path => $path,
my $entry = {
path => $path,
- size => $size,
- used => $used,
+ size => int($size), # cast to integer in case it was changed to a string previously
+ used => int($used),