factoring out regex for vztmpl
stores the regex definition in PVE::Storage. One test had to be adapted because it tested obsolete code. Namely: it expects vztmpl to only end with .tar.gz, but the new regex also includes .tar.xz, there is nothing against allowing .tar.xz files as vztmpl files. Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
339a4eb3c0
commit
bba10cf4af
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user