From 82f764e119539349cf49258f8228d6f7200d6645 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 23 Apr 2021 12:34:25 +0200 Subject: [PATCH] file-restore: return perl-y booleans MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit like we do in most of our API. Signed-off-by: Fabian Grünbichler --- PVE/API2/Storage/FileRestore.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Storage/FileRestore.pm b/PVE/API2/Storage/FileRestore.pm index 68f81eb..f6dc74a 100644 --- a/PVE/API2/Storage/FileRestore.pm +++ b/PVE/API2/Storage/FileRestore.pm @@ -56,7 +56,7 @@ __PACKAGE__->register_method ({ }, leaf => { description => "If this entry is a leaf in the directory graph.", - type => 'any', # JSON::PP::Boolean gets passed through + type => 'boolean', }, size => { description => "Entry file size.", @@ -91,6 +91,13 @@ __PACKAGE__->register_method ({ my $client = PVE::PBSClient->new($scfg, $storeid); my $ret = $client->file_restore_list($snap, $path, $base64); + + # 'leaf' is a proper JSON boolean, map to perl-y bool + # TODO: make PBSClient decode all bools always as 1/0? + foreach my $item (@$ret) { + $item->{leaf} = $item->{leaf} ? 1 : 0; + } + return $ret; }}); -- 2.39.2