download handling: adapt cycle check to check value

instead of whether the key exists in the schema instance, just in case somebody
wants to set "download => 0".

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-09-19 15:19:42 +02:00 committed by Thomas Lamprecht
parent 6dbb3e0e78
commit c1ed9e3ee6

View File

@ -1370,7 +1370,7 @@ sub validate {
my $cycles = 0;
# 'download' responses can contain a filehandle, don't cycle-check that as
# it produces a warning
my $is_download = ref($instance) eq 'HASH' && exists($instance->{download});
my $is_download = ref($instance) eq 'HASH' && $instance->{download};
find_cycle($instance, sub { $cycles = 1 }) if !$is_download;
if ($cycles) {
add_error($errors, undef, "data structure contains recursive cycles");