internxt: fix server-side moves failing with "Not Found" or "already exists"

Moving a file into a directory which had just been created failed with
"Not Found (status 404)", and moving a file over one which had just been
deleted (as sync does with --backup-dir and --suffix) failed with "A file
with the same name already exists in destination folder (status 409)".

The API checks moves against read replicas which lag behind writes, so
retry these errors until the replicas catch up.
This commit is contained in:
Nick Craig-Wood committed 2026-09-23 16:00:14 +01:00
1 parent f068abd607
commit ee26daecd8
1 file changed
+6
+6
View File
@@ -974,6 +974,12 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Move the file server-side
err = f.pacer.Call(func() (bool, error) {
err := files.MoveFile(ctx, f.cfg, srcObj.uuid, directoryID, newName, newType)
// The move is checked against lagging read replicas so it can
// fail with 404 if the destination directory was just created
// or 409 if a file at the destination was just deleted.
if err != nil && isStaleReadError(err, true) {
return true, err
}
return f.shouldRetry(ctx, err)
})
if err != nil {