]> git.proxmox.com Git - pve-common.git/commitdiff
JSONSchema: don't cycle-check 'download' responses
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 21 Apr 2021 11:15:30 +0000 (13:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 15:36:57 +0000 (17:36 +0200)
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
src/PVE/JSONSchema.pm

index 3febc1c3436fbe21295c86a969ba27c3cc3b3171..0b2db2dcb4563f320e9110fc33eca34f26cef1ed 100644 (file)
@@ -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) {