]> git.proxmox.com Git - pve-storage.git/commitdiff
fix #2226: ignore broken symlinks in *_list
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 17 Jun 2019 09:05:31 +0000 (11:05 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 17 Jun 2019 09:49:33 +0000 (11:49 +0200)
Broken symlinks (and other files without a size) will now show up as 0
byte instead of causing a format validation error in the API.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
PVE/Storage.pm

index 588e775c401c128705a19f958b2a393b2ccd0368..0ce942a066218add3fa9298c40871ee1891d2c3b 100755 (executable)
@@ -800,7 +800,7 @@ sub snippets_list {
                push @{$res->{$sid}}, {
                    volid => "$sid:snippets/". basename($fn),
                    format => 'snippet',
-                   size => -s $fn,
+                   size => -s $fn // 0,
                };
            }
        }
@@ -867,7 +867,7 @@ sub template_list {
                    $info = { volid => "$sid:backup/$1", format => $2 };
                }
 
-               $info->{size} = -s $fn;
+               $info->{size} = -s $fn // 0;
 
                push @{$res->{$sid}}, $info;
            }