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

View file

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