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

The Move method compared the source and destination paths relative to
their own Fs roots, so a server side move between two differently
rooted Fs instances on the same remote (as used by --backup-dir and
sync moves between remotes) was skipped as "already there" whenever
the relative paths coincided. With --backup-dir this destroyed the
file which was supposed to be backed up.

Compare the full paths including the Fs roots instead.
This commit is contained in:
Nick Craig-Wood
2026-07-17 18:29:39 +01:00
parent 99bef2d269
commit 727c11e081
+7 -5
View File
@@ -572,17 +572,19 @@ func (f *Fs) Rmdir(ctx context.Context, dir string) error {
// Move implements the optional method fs.Mover.Move. // Move implements the optional method fs.Mover.Move.
func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error) { 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) srcObj, ok := src.(*Object)
if !ok { if !ok {
fs.Debugf(src, "Can't move - not same remote type") fs.Debugf(src, "Can't move - not same remote type")
return nil, fs.ErrorCantMove 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) filename, folderSlug, err := f.dirCache.FindPath(ctx, remote, true)
if err != nil { if err != nil {
return nil, err return nil, err