From 895117718e3bc80eb152edb2a2d22830191a7b69 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Mon, 1 Mar 2021 22:10:45 +0100 Subject: [PATCH] SSH system command: add os separator to the resolved path when appropriate Fixes #327 --- sftpd/ssh_cmd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sftpd/ssh_cmd.go b/sftpd/ssh_cmd.go index 8a5ec9d0..6cb5cd0a 100644 --- a/sftpd/ssh_cmd.go +++ b/sftpd/ssh_cmd.go @@ -470,6 +470,10 @@ func (c *sshCommand) getSystemCommand() (systemCommand, error) { // so we need to check the quota for this directory and not its parent dir quotaPath = path.Join(sshPath, "fakecontent") } + if strings.HasSuffix(sshPath, "/") && !strings.HasSuffix(fsPath, string(os.PathSeparator)) { + fsPath += string(os.PathSeparator) + c.connection.Log(logger.LevelDebug, "path separator added to fsPath %#v", fsPath) + } args = args[:len(args)-1] args = append(args, fsPath) }