"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
fspath: change remote name regex to not match when leading/trailing space
albertony683178a1f4d2
diff --git a/fs/fspath/path.go b/fs/fspath/path.goindex 26575f725..6b8617feb 100644--- a/fs/fspath/path.go+++ b/fs/fspath/path.go@@ -13,7 +13,7 @@ import ()const (- configNameRe = `[\w. -]+`+ configNameRe = `[\w.-]+(?: +[\w.-]+)*`)var (diff --git a/fs/fspath/path_test.go b/fs/fspath/path_test.goindex c72423c0c..9d80ec4a8 100644--- a/fs/fspath/path_test.go+++ b/fs/fspath/path_test.go@@ -38,9 +38,9 @@ func TestCheckConfigName(t *testing.T) {{"..", nil},{".r.e.m.o.t.e.", nil},{"rem ote", nil},- {"remote ", nil},- {" remote", nil},- {" remote ", nil},+ {"remote ", errInvalidCharacters},+ {" remote", errInvalidCharacters},+ {" remote ", errInvalidCharacters},} {got := CheckConfigName(test.in)assert.Equal(t, test.want, got, test.in)@@ -60,9 +60,9 @@ func TestCheckRemoteName(t *testing.T) {{".r.e.m.o.t.e.:", nil},{"-r-emote-:", nil},{"rem ote:", nil},- {"remote :", nil},- {" remote:", nil},- {" remote :", nil},+ {"remote :", errInvalidCharacters},+ {" remote:", errInvalidCharacters},+ {" remote :", errInvalidCharacters},{"", errInvalidCharacters},{"rem:ote", errInvalidCharacters},{"rem:ote:", errInvalidCharacters},@@ -226,26 +226,14 @@ func TestParse(t *testing.T) {Path: "/path/to/file",},}, {- in: "remote :/path/to/file",- wantParsed: Parsed{- ConfigString: "remote ",- Name: "remote ",- Path: "/path/to/file",- },+ in: "remote :/path/to/file",+ wantErr: errInvalidCharacters,}, {- in: " remote:/path/to/file",- wantParsed: Parsed{- ConfigString: " remote",- Name: " remote",- Path: "/path/to/file",- },+ in: " remote:/path/to/file",+ wantErr: errInvalidCharacters,}, {- in: " remote :/path/to/file",- wantParsed: Parsed{- ConfigString: " remote ",- Name: " remote ",- Path: "/path/to/file",- },+ in: " remote :/path/to/file",+ wantErr: errInvalidCharacters,}, {in: "rem#ote:/path/to/file",wantErr: errInvalidCharacters,@@ -482,9 +470,9 @@ func TestSplitFs(t *testing.T) {{"rem.ote:potato/sausage", "rem.ote:", "potato/sausage", nil},{"rem ote:", "rem ote:", "", nil},- {"remote :", "remote :", "", nil},- {" remote:", " remote:", "", nil},- {" remote :", " remote :", "", nil},+ {"remote :", "", "", errInvalidCharacters},+ {" remote:", "", "", errInvalidCharacters},+ {" remote :", "", "", errInvalidCharacters},{".:", ".:", "", nil},{"..:", "..:", "", nil},@@ -539,9 +527,9 @@ func TestSplit(t *testing.T) {{"rem.ote:potato/sausage", "rem.ote:potato/", "sausage", nil},{"rem ote:", "rem ote:", "", nil},- {"remote :", "remote :", "", nil},- {" remote:", " remote:", "", nil},- {" remote :", " remote :", "", nil},+ {"remote :", "", "", errInvalidCharacters},+ {" remote:", "", "", errInvalidCharacters},+ {" remote :", "", "", errInvalidCharacters},{".:", ".:", "", nil},{"..:", "..:", "", nil},