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"
)
// 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 {

View File

@ -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