From a9a2782d7762fce89a00eb100eec2cec47b1e3af Mon Sep 17 00:00:00 2001 From: Daniel Herzig Date: Fri, 22 Nov 2024 17:57:25 +0100 Subject: [PATCH] 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 Signed-off-by: Thomas Lamprecht --- src/PVE/Storage/DirPlugin.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/Storage/DirPlugin.pm b/src/PVE/Storage/DirPlugin.pm index 532701b..734309f 100644 --- a/src/PVE/Storage/DirPlugin.pm +++ b/src/PVE/Storage/DirPlugin.pm @@ -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; }