From 6b60e09ff2f6f7fee7297ad98663bbb3617fd97c Mon Sep 17 00:00:00 2001 From: Oksana Zhykina Date: Tue, 3 Oct 2023 19:34:36 +0300 Subject: [PATCH] quatrix: overwrite files on conflict during server-side move --- backend/quatrix/api/types.go | 4 ++-- backend/quatrix/quatrix.go | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/quatrix/api/types.go b/backend/quatrix/api/types.go index 3cacdc228..0a55f5e60 100644 --- a/backend/quatrix/api/types.go +++ b/backend/quatrix/api/types.go @@ -6,8 +6,8 @@ import ( "time" ) -// OverwriteOnCopyMode is a conflict resolve mode during copy. Files with conflicting names will be overwritten -const OverwriteOnCopyMode = "overwrite" +// OverwriteMode is a conflict resolve mode during copy or move. Files with conflicting names will be overwritten +const OverwriteMode = "overwrite" // ProfileInfo is a profile info about quota type ProfileInfo struct { diff --git a/backend/quatrix/quatrix.go b/backend/quatrix/quatrix.go index 5165aaeba..dab1f5f77 100644 --- a/backend/quatrix/quatrix.go +++ b/backend/quatrix/quatrix.go @@ -729,7 +729,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, Resolve: true, MTime: api.JSONTime(srcObj.ModTime(ctx)), Name: dstLeaf, - ResolveMode: api.OverwriteOnCopyMode, + ResolveMode: api.OverwriteMode, } result := &api.File{} @@ -789,11 +789,12 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, } params := &api.FileCopyMoveOneParams{ - ID: srcObj.id, - Target: directoryID, - Resolve: false, - MTime: api.JSONTime(srcObj.ModTime(ctx)), - Name: dstLeaf, + ID: srcObj.id, + Target: directoryID, + Resolve: true, + MTime: api.JSONTime(srcObj.ModTime(ctx)), + Name: dstLeaf, + ResolveMode: api.OverwriteMode, } var resp *http.Response