From 7d40aeaa33d075d947619aae6428c08188695b80 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 19 Oct 2018 14:24:56 -0700 Subject: [PATCH] this needs to be _below_ the call to ToPath --- communicator/ssh/communicator.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 3c2fd0490..a6ebeefa2 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -563,14 +563,15 @@ func (c *comm) scpUploadSession(path string, input io.Reader, fi *os.FileInfo) e // The target directory and file for talking the SCP protocol target_dir := filepath.Dir(path) target_file := filepath.Base(path) - // Escape spaces in remote directory - target_dir = strings.Replace(target_dir, " ", "\\ ", -1) // On windows, filepath.Dir uses backslash separators (ie. "\tmp"). // This does not work when the target host is unix. Switch to forward slash // which works for unix and windows target_dir = filepath.ToSlash(target_dir) + // Escape spaces in remote directory + target_dir = strings.Replace(target_dir, " ", "\\ ", -1) + scpFunc := func(w io.Writer, stdoutR *bufio.Reader) error { return scpUploadFile(target_file, input, w, stdoutR, fi) }