$max_unit = int(log($value)/log(1024));
$value /= 1024**($max_unit);
}
-
- return sprintf "%.2f $units[$max_unit]", $value;
+ my $unit = $units[$max_unit];
+ return sprintf "%.2f $unit", $value;
}
PVE::JSONSchema::register_renderer('bytes', \&render_bytes);
my $format = $options->{'output-format'} // 'text';
- if (!$result_schema) {
+ if ($result_schema && defined($result_schema->{type})) {
return if $result_schema->{type} eq 'null';
} else {
my $type = $guess_type->($data);