X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FStorage.pm;h=71d6ad78db1255286c64d48549f10894011b9094;hb=ac5c1af57cffb79ba18c6141b96131e5790c4b2d;hp=719fe5b329148d034f19a5f4951541576e7b65ba;hpb=a0e3e224ea1bb13f4c1f4d5632c0bd6b37045a34;p=pve-storage.git diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 719fe5b..71d6ad7 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -103,7 +103,7 @@ PVE::Storage::Plugin->init(); our $iso_extension_re = qr/\.(?:iso|img)/i; -our $vztmpl_extension_re = qr/\.tar\.([gx]z)/i; +our $vztmpl_extension_re = qr/\.tar\.(gz|xz|zst)/i; # PVE::Storage utility functions @@ -1560,7 +1560,7 @@ sub extract_vzdump_config_vma { my $errstring; my $err = sub { my $output = shift; - if ($output =~ m/lzop: Broken pipe: / || $output =~ m/gzip: stdout: Broken pipe/ || $output =~ m/zstd: error 70 : Write error : Broken pipe/) { + if ($output =~ m/lzop: Broken pipe: / || $output =~ m/gzip: stdout: Broken pipe/ || $output =~ m/zstd: error 70 : Write error.*Broken pipe/) { $broken_pipe = 1; } elsif (!defined ($errstring) && $output !~ m/^\s*$/) { $errstring = "Failed to extract config from VMA archive: $output\n"; @@ -1666,10 +1666,9 @@ my $prune_mark = sub { sub prune_mark_backup_group { my ($backup_group, $keep) = @_; - my $keep_all = delete $keep->{'keep-all'}; + my @positive_opts = grep { $_ ne 'keep-all' && $keep->{$_} > 0 } keys $keep->%*; - if ($keep_all || !scalar(grep {$_ > 0} values %{$keep})) { - $keep = { 'keep-all' => 1 } if $keep_all; + if ($keep->{'keep-all'} || scalar(@positive_opts) == 0) { foreach my $prune_entry (@{$backup_group}) { $prune_entry->{mark} = 'keep'; } @@ -1945,4 +1944,16 @@ sub assert_sid_unused { return undef; } +# removes leading/trailing spaces and (back)slashes completely +# substitutes every non-ASCII-alphanumerical char with '_', except '_.-' +sub normalize_content_filename { + my ($filename) = @_; + + chomp $filename; + $filename =~ s/^.*[\/\\]//; + $filename =~ s/[^a-zA-Z0-9_.-]/_/g; + + return $filename; +} + 1;