]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage.pm
factoring out regex for vztmpl
[pve-storage.git] / PVE / Storage.pm
index ace3340179327a252c266c71a52e4c9f463653f1..e3bdffe940653491717726a00948ece8142766f1 100755 (executable)
@@ -101,6 +101,8 @@ PVE::Storage::Plugin->init();
 
 our $iso_extension_re = qr/\.(?:iso|img)/i;
 
+our $vztmpl_extension_re = qr/\.tar\.([gx]z)/i;
+
 #  PVE::Storage utility functions
 
 sub config {
@@ -573,7 +575,7 @@ sub path_to_volume_id {
        } elsif ($path =~ m!^$isodir/([^/]+$iso_extension_re)$!) {
            my $name = $1;
            return ('iso', "$sid:iso/$name");
-       } elsif ($path =~ m!^$tmpldir/([^/]+\.tar\.gz)$!) {
+       } elsif ($path =~ m!^$tmpldir/([^/]+$vztmpl_extension_re)$!) {
            my $name = $1;
            return ('vztmpl', "$sid:vztmpl/$name");
        } elsif ($path =~ m!^$privatedir/(\d+)$!) {