"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
config: allow dot in remote names (#5606)
albertony39e2af7974eb
diff --git a/docs/content/docs.md b/docs/content/docs.mdindex db83cf5fe..b508b008c 100644--- a/docs/content/docs.md+++ b/docs/content/docs.md@@ -332,7 +332,7 @@ Will get their own names### Valid remote namesRemote names are case sensitive, and must adhere to the following rules:- - May only contain `0`-`9`, `A`-`Z`, `a`-`z`, `_`, `-` and space.+ - May only contain `0`-`9`, `A`-`Z`, `a`-`z`, `_`, `-`, `.` and space.- May not start with `-` or space.Quoting and the shelldiff --git a/fs/fspath/path.go b/fs/fspath/path.goindex 846a8bb81..c67d6884c 100644--- a/fs/fspath/path.go+++ b/fs/fspath/path.go@@ -13,12 +13,12 @@ import ()const (- configNameRe = `[\w_ -]+`+ configNameRe = `[\w_. -]+`remoteNameRe = `^(:?` + configNameRe + `)`)var (- errInvalidCharacters = errors.New("config name contains invalid characters - may only contain `0-9`, `A-Z`, `a-z`, `_`, `-` and space")+ errInvalidCharacters = errors.New("config name contains invalid characters - may only contain `0-9`, `A-Z`, `a-z`, `_`, `-`, `.` and space")errCantBeEmpty = errors.New("can't use empty string as a path")errCantStartWithDash = errors.New("config name starts with `-`")errBadConfigParam = errors.New("config parameters may only contain `0-9`, `A-Z`, `a-z` and `_`")diff --git a/fs/fspath/path_test.go b/fs/fspath/path_test.goindex 61c2ff66a..e0f72681f 100644--- a/fs/fspath/path_test.go+++ b/fs/fspath/path_test.go@@ -35,6 +35,9 @@ func TestCheckConfigName(t *testing.T) {{"-remote", errCantStartWithDash},{"r-emote-", nil},{"_rem_ote_", nil},+ {".", nil},+ {"..", nil},+ {".r.e.m.o.t.e.", nil},} {got := CheckConfigName(test.in)assert.Equal(t, test.want, got, test.in)@@ -49,6 +52,9 @@ func TestCheckRemoteName(t *testing.T) {{":remote:", nil},{":s3:", nil},{"remote:", nil},+ {".:", nil},+ {"..:", nil},+ {".r.e.m.o.t.e.:", nil},{"", errInvalidCharacters},{"rem:ote", errInvalidCharacters},{"rem:ote:", errInvalidCharacters},@@ -159,6 +165,27 @@ func TestParse(t *testing.T) {ConfigString: "",Path: "path/to/file",},+ }, {+ in: ".:",+ wantParsed: Parsed{+ ConfigString: ".",+ Name: ".",+ Path: "",+ },+ }, {+ in: "..:",+ wantParsed: Parsed{+ ConfigString: "..",+ Name: "..",+ Path: "",+ },+ }, {+ in: ".:colon.txt",+ wantParsed: Parsed{+ ConfigString: ".",+ Name: ".",+ Path: "colon.txt",+ },}, {in: "remote:path/to/file",wantParsed: Parsed{@@ -177,7 +204,14 @@ func TestParse(t *testing.T) {Path: "/path/to/file",},}, {- in: "rem.ote:/path/to/file",+ in: "rem.ote:/path/to/file",+ wantParsed: Parsed{+ ConfigString: "rem.ote",+ Name: "rem.ote",+ Path: "/path/to/file",+ },+ }, {+ in: "rem#ote:/path/to/file",wantErr: errInvalidCharacters,}, {in: ":backend:/path/to/file",@@ -186,6 +220,13 @@ func TestParse(t *testing.T) {Name: ":backend",Path: "/path/to/file",},+ }, {+ in: ":back.end:/path/to/file",+ wantParsed: Parsed{+ ConfigString: ":back.end",+ Name: ":back.end",+ Path: "/path/to/file",+ },}, {in: ":bac*kend:/path/to/file",wantErr: errInvalidCharacters,@@ -218,6 +259,20 @@ func TestParse(t *testing.T) {Path: `\path\to\file`,},noWin: true,+ }, {+ in: `.`,+ wantParsed: Parsed{+ Name: "",+ Path: `.`,+ },+ noWin: true,+ }, {+ in: `..`,+ wantParsed: Parsed{+ Name: "",+ Path: `..`,+ },+ noWin: true,}, {in: `remote:\path\to\file`,wantParsed: Parsed{@@ -388,7 +443,12 @@ func TestSplitFs(t *testing.T) {{"remote:/potato", "remote:", "/potato", nil},{"remote:/potato/potato", "remote:", "/potato/potato", nil},{"remote:potato/sausage", "remote:", "potato/sausage", nil},- {"rem.ote:potato/sausage", "", "", errInvalidCharacters},+ {"rem.ote:potato/sausage", "rem.ote:", "potato/sausage", nil},++ {".:", ".:", "", nil},+ {"..:", "..:", "", nil},+ {".:potato/sausage", ".:", "potato/sausage", nil},+ {"..:potato/sausage", "..:", "potato/sausage", nil},{":remote:", ":remote:", "", nil},{":remote:potato", ":remote:", "potato", nil},@@ -396,8 +456,14 @@ func TestSplitFs(t *testing.T) {{":remote:/potato", ":remote:", "/potato", nil},{":remote:/potato/potato", ":remote:", "/potato/potato", nil},{":remote:potato/sausage", ":remote:", "potato/sausage", nil},+ {":rem.ote:potato/sausage", ":rem.ote:", "potato/sausage", nil},{":rem[ote:potato/sausage", "", "", errInvalidCharacters},+ {":.:", ":.:", "", nil},+ {":..:", ":..:", "", nil},+ {":.:potato/sausage", ":.:", "potato/sausage", nil},+ {":..:potato/sausage", ":..:", "potato/sausage", nil},+{"/", "", "/", nil},{"/root", "", "/root", nil},{"/a/b", "", "/a/b", nil},@@ -429,7 +495,12 @@ func TestSplit(t *testing.T) {{"remote:/potato", "remote:/", "potato", nil},{"remote:/potato/potato", "remote:/potato/", "potato", nil},{"remote:potato/sausage", "remote:potato/", "sausage", nil},- {"rem.ote:potato/sausage", "", "", errInvalidCharacters},+ {"rem.ote:potato/sausage", "rem.ote:potato/", "sausage", nil},++ {".:", ".:", "", nil},+ {"..:", "..:", "", nil},+ {".:potato/sausage", ".:potato/", "sausage", nil},+ {"..:potato/sausage", "..:potato/", "sausage", nil},{":remote:", ":remote:", "", nil},{":remote:potato", ":remote:", "potato", nil},@@ -437,8 +508,14 @@ func TestSplit(t *testing.T) {{":remote:/potato", ":remote:/", "potato", nil},{":remote:/potato/potato", ":remote:/potato/", "potato", nil},{":remote:potato/sausage", ":remote:potato/", "sausage", nil},+ {":rem.ote:potato/sausage", ":rem.ote:potato/", "sausage", nil},{":rem[ote:potato/sausage", "", "", errInvalidCharacters},+ {":.:", ":.:", "", nil},+ {":..:", ":..:", "", nil},+ {":.:potato/sausage", ":.:potato/", "sausage", nil},+ {":..:potato/sausage", ":..:potato/", "sausage", nil},+{"/", "/", "", nil},{"/root", "/", "root", nil},{"/a/b", "/a/", "b", nil},