download handling: adapt to method schema field rename

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-09-19 15:19:49 +02:00 committed by Thomas Lamprecht
parent 2e489489ab
commit 69698ccc63
3 changed files with 8 additions and 3 deletions

View File

@ -906,7 +906,7 @@ __PACKAGE__->register_method({
check => ['perm', '/nodes/{node}', [ 'Sys.Syslog' ]], check => ['perm', '/nodes/{node}', [ 'Sys.Syslog' ]],
}, },
protected => 1, protected => 1,
download => 1, download_allowed => 1,
parameters => { parameters => {
additionalProperties => 0, additionalProperties => 0,
properties => { properties => {

View File

@ -327,7 +327,7 @@ __PACKAGE__->register_method({
user => 'all', user => 'all',
}, },
protected => 1, protected => 1,
download => 1, download_allowed => 1,
description => "Read task log.", description => "Read task log.",
proxyto => 'node', proxyto => 'node',
parameters => { parameters => {

View File

@ -351,7 +351,12 @@ sub call_api_method {
$data = $handler->handle($info, $param); $data = $handler->handle($info, $param);
if (ref($data) eq 'HASH' && ref($data->{download}) eq 'HASH' && $info->{download}) { # TODO: remove 'download' check with PVE 9.0
if (
ref($data) eq 'HASH'
&& ref($data->{download}) eq 'HASH'
&& ($info->{download_allowed} || $info->{download})
) {
$data = $handle_streamed_response->($data->{download}) $data = $handle_streamed_response->($data->{download})
} }
} }