mirror of
https://github.com/rclone/rclone.git
synced 2025-08-15 16:22:47 +02:00
pcloud: delete half uploaded files on upload error
Sometimes pcloud will leave a half uploaded file when the transfer actually failed. This patch deletes the file if it exists. This problem was spotted by the integration tests.
This commit is contained in:
@ -1107,6 +1107,12 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptio
|
||||
return shouldRetry(resp, err)
|
||||
})
|
||||
if err != nil {
|
||||
// sometimes pcloud leaves a half complete file on
|
||||
// error, so delete it if it exists
|
||||
delObj, delErr := o.fs.NewObject(o.remote)
|
||||
if delErr == nil && delObj != nil {
|
||||
_ = delObj.Remove()
|
||||
}
|
||||
return err
|
||||
}
|
||||
if len(result.Items) != 1 {
|
||||
|
Reference in New Issue
Block a user