"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
memory: fix incorrect list entries when rooted at subdirectory
nielashf62e7b5b30be
diff --git a/backend/memory/memory.go b/backend/memory/memory.goindex 608f42292..48cc9678b 100644--- a/backend/memory/memory.go+++ b/backend/memory/memory.go@@ -296,7 +296,7 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuckslash := strings.IndexRune(localPath, '/')if slash >= 0 {// send a directory if have a slash- dir := directory + localPath[:slash]+ dir := strings.TrimPrefix(directory, f.rootDirectory+"/") + localPath[:slash]if addBucket {dir = path.Join(bucket, dir)}diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex 72527a1e4..80be1cbe0 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -24,6 +24,7 @@ import ("time""github.com/rclone/rclone/fs"+ "github.com/rclone/rclone/fs/cache""github.com/rclone/rclone/fs/config""github.com/rclone/rclone/fs/fserrors""github.com/rclone/rclone/fs/fspath"@@ -1209,6 +1210,28 @@ func Run(t *testing.T, opt *Opt) {}, fs.GetModifyWindow(ctx, f))})+ // TestFsListRootedSubdir tests putting and listing with an Fs that is rooted at a subdirectory 2 levels down+ TestFsListRootedSubdir := func(t *testing.T) {+ skipIfNotOk(t)+ newF, err := cache.Get(ctx, subRemoteName+"/hello? sausage/êé")+ assert.NoError(t, err)+ nestedFile := fstest.Item{+ ModTime: fstest.Time("2001-02-03T04:05:06.499999999Z"),+ Path: "a/b/c/d/e.txt",+ }+ _, _ = testPut(ctx, t, newF, &nestedFile)++ objs, dirs, err := walk.GetAll(ctx, newF, "", true, 10)+ require.NoError(t, err)+ assert.Equal(t, []string{`Hello, 世界/ " ' @ < > & ? + ≠/z.txt`, nestedFile.Path}, objsToNames(objs))+ assert.Equal(t, []string{`Hello, 世界`, `Hello, 世界/ " ' @ < > & ? + ≠`, "a", "a/b", "a/b/c", "a/b/c/d"}, dirsToNames(dirs))++ // cleanup+ err = operations.Purge(ctx, newF, "a")+ require.NoError(t, err)+ }+ t.Run("FsListRootedSubdir", TestFsListRootedSubdir)+// TestFsCopy tests Copyt.Run("FsCopy", func(t *testing.T) {skipIfNotOk(t)