diff --git a/src/restic/backend/location/location_test.go b/src/restic/backend/location/location_test.go index fe07ee506..47260669a 100644 --- a/src/restic/backend/location/location_test.go +++ b/src/restic/backend/location/location_test.go @@ -79,7 +79,7 @@ var parseTests = []struct { Config: sftp.Config{ User: "user", Host: "host", - Dir: "/srv/repo", + Path: "/srv/repo", }, }, }, @@ -89,7 +89,7 @@ var parseTests = []struct { Config: sftp.Config{ User: "", Host: "host", - Dir: "/srv/repo", + Path: "/srv/repo", }, }, }, @@ -99,7 +99,7 @@ var parseTests = []struct { Config: sftp.Config{ User: "user", Host: "host", - Dir: "srv/repo", + Path: "srv/repo", }, }, }, @@ -109,7 +109,7 @@ var parseTests = []struct { Config: sftp.Config{ User: "user", Host: "host", - Dir: "/srv/repo", + Path: "/srv/repo", }, }, }, diff --git a/src/restic/backend/sftp/config.go b/src/restic/backend/sftp/config.go index 9a1ac35de..4321e71ad 100644 --- a/src/restic/backend/sftp/config.go +++ b/src/restic/backend/sftp/config.go @@ -10,9 +10,9 @@ import ( // Config collects all information required to connect to an sftp server. type Config struct { - User, Host, Dir string - Layout string `option:"layout"` - Command string `option:"command"` + User, Host, Path string + Layout string `option:"layout"` + Command string `option:"command"` } // ParseConfig parses the string s and extracts the sftp config. The @@ -62,6 +62,6 @@ func ParseConfig(s string) (interface{}, error) { return Config{ User: user, Host: host, - Dir: path.Clean(dir), + Path: path.Clean(dir), }, nil } diff --git a/src/restic/backend/sftp/config_test.go b/src/restic/backend/sftp/config_test.go index d0350745c..44439005e 100644 --- a/src/restic/backend/sftp/config_test.go +++ b/src/restic/backend/sftp/config_test.go @@ -9,53 +9,53 @@ var configTests = []struct { // first form, user specified sftp://user@host/dir { "sftp://user@host/dir/subdir", - Config{User: "user", Host: "host", Dir: "dir/subdir"}, + Config{User: "user", Host: "host", Path: "dir/subdir"}, }, { "sftp://host/dir/subdir", - Config{Host: "host", Dir: "dir/subdir"}, + Config{Host: "host", Path: "dir/subdir"}, }, { "sftp://host//dir/subdir", - Config{Host: "host", Dir: "/dir/subdir"}, + Config{Host: "host", Path: "/dir/subdir"}, }, { "sftp://host:10022//dir/subdir", - Config{Host: "host:10022", Dir: "/dir/subdir"}, + Config{Host: "host:10022", Path: "/dir/subdir"}, }, { "sftp://user@host:10022//dir/subdir", - Config{User: "user", Host: "host:10022", Dir: "/dir/subdir"}, + Config{User: "user", Host: "host:10022", Path: "/dir/subdir"}, }, { "sftp://user@host/dir/subdir/../other", - Config{User: "user", Host: "host", Dir: "dir/other"}, + Config{User: "user", Host: "host", Path: "dir/other"}, }, { "sftp://user@host/dir///subdir", - Config{User: "user", Host: "host", Dir: "dir/subdir"}, + Config{User: "user", Host: "host", Path: "dir/subdir"}, }, // second form, user specified sftp:user@host:/dir { "sftp:user@host:/dir/subdir", - Config{User: "user", Host: "host", Dir: "/dir/subdir"}, + Config{User: "user", Host: "host", Path: "/dir/subdir"}, }, { "sftp:host:../dir/subdir", - Config{Host: "host", Dir: "../dir/subdir"}, + Config{Host: "host", Path: "../dir/subdir"}, }, { "sftp:user@host:dir/subdir:suffix", - Config{User: "user", Host: "host", Dir: "dir/subdir:suffix"}, + Config{User: "user", Host: "host", Path: "dir/subdir:suffix"}, }, { "sftp:user@host:dir/subdir/../other", - Config{User: "user", Host: "host", Dir: "dir/other"}, + Config{User: "user", Host: "host", Path: "dir/other"}, }, { "sftp:user@host:dir///subdir", - Config{User: "user", Host: "host", Dir: "dir/subdir"}, + Config{User: "user", Host: "host", Path: "dir/subdir"}, }, } diff --git a/src/restic/backend/sftp/sftp.go b/src/restic/backend/sftp/sftp.go index b0b796df6..356317ba6 100644 --- a/src/restic/backend/sftp/sftp.go +++ b/src/restic/backend/sftp/sftp.go @@ -32,6 +32,7 @@ type SFTP struct { result <-chan error backend.Layout + Config } var _ restic.Backend = &SFTP{}