]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Storage/Status.pm
factoring out regex for vztmpl
[pve-storage.git] / PVE / API2 / Storage / Status.pm
index 8a36aefb8c5d22d0c4b80eb0f805d78ce99f0a92..70692444c6177b3847508d16719347ca6e3e39c7 100644 (file)
@@ -423,12 +423,12 @@ __PACKAGE__->register_method ({
 
        if ($content eq 'iso') {
            if ($filename !~ m![^/]+$PVE::Storage::iso_extension_re$!) {
-               raise_param_exc({ filename => "missing '.iso' or '.img' extension" });
+               raise_param_exc({ filename => "wrong file extension" });
            }
            $path = PVE::Storage::get_iso_dir($cfg, $param->{storage});
        } elsif ($content eq 'vztmpl') {
-           if ($filename !~ m![^/]+\.tar\.[gx]z$!) {
-               raise_param_exc({ filename => "missing '.tar.gz' or '.tar.xz' extension" });
+           if ($filename !~ m![^/]+$PVE::Storage::vztmpl_extension_re$!) {
+               raise_param_exc({ filename => "wrong file extension" });
            }
            $path = PVE::Storage::get_vztmpl_dir($cfg, $param->{storage});
        } else {