"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
Fix crypt obfuscate tests with Windows
Nick Craig-Woodeaa717b88aec
diff --git a/crypt/crypt_config_test.go b/crypt/crypt_config_test.goindex 954ab9f31..3cbe82996 100644--- a/crypt/crypt_config_test.go+++ b/crypt/crypt_config_test.go@@ -30,4 +30,5 @@ func init() {{Name: name3, Key: "password", Value: fs.MustObscure("potato2")},{Name: name3, Key: "filename_encryption", Value: "obfuscate"},}+ fstests.SkipBadWindowsCharacters[name3+":"] = true}diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex fd996e89d..75b49f2b2 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -35,7 +35,9 @@ var (NilObject fs.Object// ExtraConfig is for adding config to a remoteExtraConfig = []ExtraConfigItem{}- file1 = fstest.Item{+ // SkipBadWindowsCharacters skips unusable characters for windows if set+ SkipBadWindowsCharacters = map[string]bool{}+ file1 = fstest.Item{ModTime: fstest.Time("2001-02-03T04:05:06.499999999Z"),Path: "file name.txt",}@@ -59,6 +61,12 @@ type ExtraConfigItem struct{ Name, Key, Value string }func TestInit(t *testing.T) {var err error+ // Remove bad characters from Windows file name if set+ if SkipBadWindowsCharacters[RemoteName] {+ t.Logf("Removing bad windows characters from test file")+ file2.Path = winPath(file2.Path)+ }+// Never ask for passwords, fail instead.// If your local config is encrypted set environment variable// "RCLONE_CONFIG_PASS=hunter2" (or your password)@@ -165,11 +173,13 @@ func TestFsListEmpty(t *testing.T) {// winPath converts a path into a windows safe pathfunc winPath(s string) string {- s = strings.Replace(s, "?", "_", -1)- s = strings.Replace(s, `"`, "_", -1)- s = strings.Replace(s, "<", "_", -1)- s = strings.Replace(s, ">", "_", -1)- return s+ return strings.Map(func(r rune) rune {+ switch r {+ case '<', '>', '"', '|', '?', '*', ':':+ return '_'+ }+ return r+ }, s)}// dirsToNames returns a sorted list of names@@ -323,9 +333,9 @@ func TestFsListDirFile2(t *testing.T) {list := func(dir string, expectedDirNames, expectedObjNames []string) {var objNames, dirNames []stringfor i := 1; i <= *fstest.ListRetries; i++ {- objs, dirs, err := fs.WalkGetAll(remote, dir, false, 1)- if err == fs.ErrorDirNotFound {- objs, dirs, err = fs.WalkGetAll(remote, winPath(dir), false, 1)+ objs, dirs, err := fs.WalkGetAll(remote, dir, true, 1)+ if errors.Cause(err) == fs.ErrorDirNotFound {+ objs, dirs, err = fs.WalkGetAll(remote, winPath(dir), true, 1)}require.NoError(t, err)objNames = objsToNames(objs)