webdav: Attempt to remove failed uploads

Some webdav backends (eg rclone serve webdav) leave behind half
written files on error.  This causes the integration tests to
fail. Here we remove the file if it exists.
This commit is contained in:
Nick Craig-Wood 2018-08-16 16:00:30 +01:00
parent 58339a5cb6
commit eb84b58d3c
1 changed files with 2 additions and 0 deletions

View File

@ -968,6 +968,8 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptio
return shouldRetry(resp, err)
})
if err != nil {
// Remove failed upload
_ = o.Remove()
return err
}
// read metadata from remote