Am 2/21/20 um 11:02 AM schrieb Dominik Csapak:
> this way the api also returns the vmid on content listings
> (useful for the gui for filtering)
> 
> Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
> ---
>  PVE/Storage/Plugin.pm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
> index fb06c38..83bbf69 100644
> --- a/PVE/Storage/Plugin.pm
> +++ b/PVE/Storage/Plugin.pm
> @@ -921,7 +921,13 @@ my $get_subdir_files = sub {
>           next if defined($vmid) && $fn !~  m/\S+-$vmid-\S+/;
>           next if $fn !~ 
> m!/([^/]+\.(tar|tar\.gz|tar\.lzo|tgz|vma|vma\.gz|vma\.lzo))$!;
>  
> -         $info = { volid => "$sid:backup/$1", format => $2 };
> +         my $format = $2;
> +         $info = { volid => "$sid:backup/$1", format => $format };
> +
> +         if (defined($vmid) || $fn =~ m!\-([0-9]{3,})\-[^/]+\.${format}$!) {

applied but fixed the VMID regex by just using the one from JSONSchema,
as else you wrongly also detect integers with leading zeros as VMID, or
such long integers which are not valid VMIDs either and may make problems
further down the stack, so used for the VMID part:
([1-9][0-9]{2,8})

> +             $info->{vmid} = $vmid // $1;
> +         }
> +
>  
>       } elsif ($tt eq 'snippets') {
>  
> 


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to