]> git.proxmox.com Git - pve-container.git/commitdiff
Fix: check if compression_map format is undefined
authorAlwin Antreich <a.antreich@proxmox.com>
Thu, 23 May 2019 07:13:40 +0000 (09:13 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 May 2019 07:26:56 +0000 (09:26 +0200)
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 <a.antreich@proxmox.com>
Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC/Create.pm

index 8affe3fb64ac7099511690aebc476a3a7ee446c0..e15d09120351968ca99c11792ff010a58bd04aa9 100644 (file)
@@ -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";