[pve-devel] [PATCH storage v2] dirplugin: fix #3986: check for trailing slashes

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Nov 22 15:52:09 CET 2024


Am 22.11.24 um 14:13 schrieb Daniel Herzig:
> diff --git a/src/PVE/Storage/DirPlugin.pm b/src/PVE/Storage/DirPlugin.pm
> index fb23e0a..c72c321 100644
> --- a/src/PVE/Storage/DirPlugin.pm
> +++ b/src/PVE/Storage/DirPlugin.pm
> @@ -245,6 +245,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} =~ s|(.*[^/])/+$|$1|;

If we want to use the always available File::Spec module, like Max wanted to
in a recent series, this could be changed to

$opts->{path} = File::Spec->canonpath($opts->{path});

>      return $opts;
>  }
>  





More information about the pve-devel mailing list