From f6c2787d806167b8059aca28bb4004d71bd0d695 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 11 Aug 2016 19:10:51 +0200 Subject: [PATCH] Use the platform-independent function for joining --- src/restic/backend/sftp/sftp.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/restic/backend/sftp/sftp.go b/src/restic/backend/sftp/sftp.go index 4279b8d5a..97a53c56f 100644 --- a/src/restic/backend/sftp/sftp.go +++ b/src/restic/backend/sftp/sftp.go @@ -8,13 +8,15 @@ import ( "log" "os" "os/exec" + "path" "path/filepath" "strings" - "github.com/juju/errors" - "github.com/pkg/sftp" "restic/backend" "restic/debug" + + "github.com/juju/errors" + "github.com/pkg/sftp" ) const ( @@ -250,9 +252,10 @@ func (r *SFTP) renameFile(oldname string, t backend.Type, name string) error { return r.c.Chmod(filename, fi.Mode()&os.FileMode(^uint32(0222))) } -// Join joins the given paths and cleans them afterwards. +// Join joins the given paths and cleans them afterwards. This always uses +// forward slashes, which is required by sftp. func Join(parts ...string) string { - return filepath.Clean(strings.Join(parts, "/")) + return path.Clean(path.Join(parts...)) } // Construct path for given backend.Type and name.