fix #6584: plugin: list_images: only include parseable filenames

by only including filenames that are also valid when actually parsing them,
things like snapshot files or files not following our naming scheme are no
longer candidates for rescanning or included in other output.

Co-authored-by: Shannon Sterz <s.sterz@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Shannon Sterz <s.sterz@proxmox.com>
Link: https://lore.proxmox.com/20250731111519.931104-3-f.gruenbichler@proxmox.com
This commit is contained in:
Fabian Grünbichler
2025-07-31 13:15:17 +02:00
committed by Thomas Lamprecht
parent a477189575
commit 59a54b3d5f

View File

@ -1555,6 +1555,10 @@ sub list_images {
next if !$vollist && defined($vmid) && ($owner ne $vmid);
# skip files that are snapshots or have invalid names
my ($parsed_name) = eval { parse_name_dir(basename($fn)) };
next if !defined($parsed_name);
my ($size, undef, $used, $parent, $ctime) = eval { file_size_info($fn, undef, $format); };
if (my $err = $@) {
die $err if $err !~ m/Image is not in \S+ format$/;