From 796013dd06f66290755bcc7329204b03b78e8976 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 8 Sep 2024 12:02:01 +0100 Subject: [PATCH] gofile: fix Move a file For some reason the parent ID got out of date in the Object (exact reason not known - but the fact that this was OK before suggests a change in the provider). However we know the parent ID as it is in the directory cache, so use that instead. --- backend/gofile/gofile.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/gofile/gofile.go b/backend/gofile/gofile.go index 4b009e8cb..f6906b4e6 100644 --- a/backend/gofile/gofile.go +++ b/backend/gofile/gofile.go @@ -1105,6 +1105,12 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, return nil, fs.ErrorCantMove } + // Find existing object + srcLeaf, srcDirectoryID, err := srcObj.fs.dirCache.FindPath(ctx, srcObj.remote, false) + if err != nil { + return nil, err + } + // Create temporary object dstObj, dstLeaf, dstDirectoryID, err := f.createObject(ctx, remote, srcObj.modTime, srcObj.size) if err != nil { @@ -1112,7 +1118,7 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, } // Do the move - info, err := f.moveTo(ctx, srcObj.id, path.Base(srcObj.remote), dstLeaf, srcObj.dirID, dstDirectoryID) + info, err := f.moveTo(ctx, srcObj.id, srcLeaf, dstLeaf, srcDirectoryID, dstDirectoryID) if err != nil { return nil, err }