add support for a start directory

Fixes #705

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-03-03 12:44:56 +01:00
parent 4519bffa39
commit 5c2fd8d52a
28 changed files with 478 additions and 94 deletions

View File

@@ -531,7 +531,7 @@ func (c *sshCommand) getDestPath() string {
if len(c.args) == 0 {
return ""
}
return cleanCommandPath(c.args[len(c.args)-1])
return c.cleanCommandPath(c.args[len(c.args)-1])
}
// for the supported commands, the destination path, if any, is the second-last argument
@@ -539,13 +539,13 @@ func (c *sshCommand) getSourcePath() string {
if len(c.args) < 2 {
return ""
}
return cleanCommandPath(c.args[len(c.args)-2])
return c.cleanCommandPath(c.args[len(c.args)-2])
}
func cleanCommandPath(name string) string {
func (c *sshCommand) cleanCommandPath(name string) string {
name = strings.Trim(name, "'")
name = strings.Trim(name, "\"")
result := util.CleanPath(name)
result := c.connection.User.GetCleanedPath(name)
if strings.HasSuffix(name, "/") && !strings.HasSuffix(result, "/") {
result += "/"
}