fix #3986: directory plugin: remove trailing slashes

Currently, setting up a directory storage with trailing slashes in the
path results in log messages with double slashes, if this path gets
expanded by an action like vzdump. While this is just a cosmetic
issue, it looks odd and some users might think this is a bug if they
currently investigate some other issue and see such paths.

This patch removes those trailing slashes once the directory storage
class config gets updated.

Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Daniel Herzig
2024-11-22 17:57:25 +01:00
committed by Thomas Lamprecht
parent 32f55f8c0d
commit a9a2782d77

View File

@ -6,6 +6,7 @@ use warnings;
use Cwd;
use Encode qw(decode encode);
use File::Path;
use File::Spec;
use IO::File;
use POSIX;
@ -246,6 +247,8 @@ sub check_config {
if ($opts->{path} !~ m|^/[-/a-zA-Z0-9_.@]+$|) {
die "illegal path for directory storage: $opts->{path}\n";
}
# remove trailing slashes from path
$opts->{path} = File::Spec->canonpath($opts->{path});
return $opts;
}