[pve-devel] [PATCH storage] dirplugin: fix #3986: check for trailing slashes
Daniel Herzig
d.herzig at proxmox.com
Wed Nov 13 17:32:49 CET 2024
This patch removes trailing slashes from manually entered
paths by adding an additional if clause in the sub
check_config.
Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
---
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 2efa8d5..9dcdf4a 100644
--- a/src/PVE/Storage/DirPlugin.pm
+++ b/src/PVE/Storage/DirPlugin.pm
@@ -244,6 +244,9 @@ sub check_config {
if ($opts->{path} !~ m|^/[-/a-zA-Z0-9_.@]+$|) {
die "illegal path for directory storage: $opts->{path}\n";
}
+ if ($opts->{path} =~ /.*\/$/) {
+ $opts->{path} = substr($opts->{path}, 0 , -1);
+ }
return $opts;
}
--
2.39.5
More information about the pve-devel
mailing list