mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 00:13:49 +01:00
putio: fix server side copying over existing object
This was causing a conflict error. This was fixed by checking for the existing object and deleting it after the file was server side copied.
This commit is contained in:
parent
f307d929a8
commit
740f6b318c
@ -572,6 +572,17 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (o fs.Objec
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We have successfully copied the file to random name
|
||||||
|
// Check to see if file already exists first and delete it if so
|
||||||
|
existingObj, err := f.NewObject(ctx, remote)
|
||||||
|
if err == nil {
|
||||||
|
err = existingObj.Remove(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("server side copy: failed to remove existing file: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = f.pacer.Call(func() (bool, error) {
|
err = f.pacer.Call(func() (bool, error) {
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
params.Set("file_id", strconv.FormatInt(resp.File.ID, 10))
|
params.Set("file_id", strconv.FormatInt(resp.File.ID, 10))
|
||||||
|
Loading…
Reference in New Issue
Block a user