From 539660e2bd3e9a557a8c0ce7e17865377bf269b9 Mon Sep 17 00:00:00 2001 From: Alwin Antreich Date: Thu, 23 May 2019 09:13:40 +0200 Subject: [PATCH] Fix: check if compression_map format is undefined We want to check for an supported compression type, but the check was not correct as this only works if both sides are scalars, but an assignment to an array is always "truthy", so actually check explicitly if the compression type is supported before. Signed-off-by: Alwin Antreich Co-authored-by: Thomas Lamprecht --- src/PVE/LXC/Create.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm index 8affe3f..e15d091 100644 --- a/src/PVE/LXC/Create.pm +++ b/src/PVE/LXC/Create.pm @@ -81,8 +81,8 @@ sub restore_archive { ); if ($archive =~ /\.tar(\.[^.]+)?$/) { if (defined($1)) { - @compression_opt = $compression_map{$1} - or die "unrecognized compression format: $1\n"; + die "unrecognized compression format: $1\n" if (!defined($compression_map{$1})); + @compression_opt = $compression_map{$1}; } } else { die "file does not look like a template archive: $archive\n"; -- 2.39.2