Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

ulozto: fix server side moves between differently rooted remotes losing files

Nick Craig-Wood727c11e081ee
diff --git a/backend/ulozto/ulozto.go b/backend/ulozto/ulozto.go
index 8cab77fee..6aa80d9ab 100644
--- a/backend/ulozto/ulozto.go
+++ b/backend/ulozto/ulozto.go
@@ -572,17 +572,19 @@ func (f *Fs) Rmdir(ctx context.Context, dir string) error {
// Move implements the optional method fs.Mover.Move.
func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error) {
- if remote == src.Remote() {
- // Already there, do nothing
- return src, nil
- }
-
srcObj, ok := src.(*Object)
if !ok {
fs.Debugf(src, "Can't move - not same remote type")
return nil, fs.ErrorCantMove
}
+ // src may be on a differently rooted Fs (eg with --backup-dir) so
+ // compare the full paths including the Fs roots
+ if path.Join(srcObj.fs.root, srcObj.remote) == path.Join(f.root, remote) {
+ // Already there, do nothing
+ return src, nil
+ }
+
filename, folderSlug, err := f.dirCache.FindPath(ctx, remote, true)
if err != nil {
return nil, err