quatrix: overwrite files on conflict during server-side move

This commit is contained in:
Oksana Zhykina 2023-10-03 19:34:36 +03:00 committed by Nick Craig-Wood
parent 41a52f50df
commit 6b60e09ff2
2 changed files with 9 additions and 8 deletions

View file

@ -6,8 +6,8 @@ import (
"time" "time"
) )
// OverwriteOnCopyMode is a conflict resolve mode during copy. Files with conflicting names will be overwritten // OverwriteMode is a conflict resolve mode during copy or move. Files with conflicting names will be overwritten
const OverwriteOnCopyMode = "overwrite" const OverwriteMode = "overwrite"
// ProfileInfo is a profile info about quota // ProfileInfo is a profile info about quota
type ProfileInfo struct { type ProfileInfo struct {

View file

@ -729,7 +729,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
Resolve: true, Resolve: true,
MTime: api.JSONTime(srcObj.ModTime(ctx)), MTime: api.JSONTime(srcObj.ModTime(ctx)),
Name: dstLeaf, Name: dstLeaf,
ResolveMode: api.OverwriteOnCopyMode, ResolveMode: api.OverwriteMode,
} }
result := &api.File{} result := &api.File{}
@ -789,11 +789,12 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
} }
params := &api.FileCopyMoveOneParams{ params := &api.FileCopyMoveOneParams{
ID: srcObj.id, ID: srcObj.id,
Target: directoryID, Target: directoryID,
Resolve: false, Resolve: true,
MTime: api.JSONTime(srcObj.ModTime(ctx)), MTime: api.JSONTime(srcObj.ModTime(ctx)),
Name: dstLeaf, Name: dstLeaf,
ResolveMode: api.OverwriteMode,
} }
var resp *http.Response var resp *http.Response