From 6ab98c4e537099162919ac75f3f767e406d84bec Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Wed, 21 Apr 2021 13:15:30 +0200 Subject: [PATCH] JSONSchema: don't cycle-check 'download' responses Signed-off-by: Stefan Reiter --- src/PVE/JSONSchema.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 3febc1c..0b2db2d 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -1183,7 +1183,10 @@ sub validate { # we can disable that in the final release # todo: is there a better/faster way to detect cycles? my $cycles = 0; - find_cycle($instance, sub { $cycles = 1 }); + # '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}); + find_cycle($instance, sub { $cycles = 1 }) if !$is_download; if ($cycles) { add_error($errors, undef, "data structure contains recursive cycles"); } elsif ($schema) { -- 2.39.2