mirror of
https://git.proxmox.com/git/pve-common
synced 2025-04-28 17:07:50 +00:00
format: fix render_bytes with CLIFormatter
CLIFormatter passes in an options hash as a second paramter, which so far was ignored. Now that we treat it as a precision parameter, check if it is a hash and extract the option from it before using it. Otherwise perl puts HASH(0x...) into the format and sprintf chokes. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
ef737f0b3c
commit
3bb8802a08
@ -64,6 +64,8 @@ sub render_fraction_as_percentage {
|
||||
sub render_bytes {
|
||||
my ($value, $precision) = @_;
|
||||
|
||||
$precision = $precision->{precision} if ref($precision) eq 'HASH';
|
||||
|
||||
my @units = qw(B KiB MiB GiB TiB PiB);
|
||||
|
||||
my $max_unit = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user