@@ -52,7 +52,7 @@ func (rsf *ReverseSSHFS) Prepare() error {
5252 sshArgs = append (sshArgs , "-p" , strconv .Itoa (rsf .Port ))
5353 }
5454 sshArgs = append (sshArgs , rsf .Host , "--" )
55- sshArgs = append (sshArgs , "mkdir" , "-p" , rsf .RemotePath )
55+ sshArgs = append (sshArgs , "mkdir" , "-p" , strconv . Quote ( rsf .RemotePath ) )
5656 sshCmd := exec .Command (sshBinary , sshArgs ... )
5757 logrus .Debugf ("executing ssh for preparing sshfs: %s %v" , sshCmd .Path , sshCmd .Args )
5858 out , err := sshCmd .CombinedOutput ()
@@ -138,7 +138,7 @@ func (rsf *ReverseSSHFS) Start() error {
138138 sshArgs = append (sshArgs , "-p" , strconv .Itoa (rsf .Port ))
139139 }
140140 sshArgs = append (sshArgs , rsf .Host , "--" )
141- sshArgs = append (sshArgs , "sshfs" , ":" + rsf .LocalPath , rsf .RemotePath , "-o" , "slave" )
141+ sshArgs = append (sshArgs , "sshfs" , strconv . Quote ( ":" + rsf .LocalPath ), strconv . Quote ( rsf .RemotePath ) , "-o" , "slave" )
142142 if rsf .Readonly {
143143 sshArgs = append (sshArgs , "-o" , "ro" )
144144 }
@@ -261,7 +261,8 @@ export LANG LC_ALL
261261i=0
262262while : ; do
263263 # FIXME: not really robust
264- if mount | grep "on ${dir}" | egrep -qw "fuse.sshfs|osxfuse"; then
264+ # spaces in file names are encoded as '\040' in the mount table
265+ if mount | sed 's/\\040/ /g' | grep "on ${dir}" | egrep -qw "fuse.sshfs|osxfuse"; then
265266 echo '{"return":{}}'
266267 exit 0
267268 fi
0 commit comments