forked from TrueCloudLab/rclone
onedrive: fix uploading empty files with go1.8
This commit is contained in:
parent
99f7fe736a
commit
6474f2c7c2
1 changed files with 5 additions and 0 deletions
|
@ -1024,6 +1024,11 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo) (err error) {
|
||||||
Path: "/drive/root:/" + url.QueryEscape(o.srvPath()) + ":/content",
|
Path: "/drive/root:/" + url.QueryEscape(o.srvPath()) + ":/content",
|
||||||
Body: in,
|
Body: in,
|
||||||
}
|
}
|
||||||
|
// for go1.8 (see release notes) we must nil the Body if we want a
|
||||||
|
// "Content-Length: 0" header which onedrive requires for all files.
|
||||||
|
if size == 0 {
|
||||||
|
opts.Body = nil
|
||||||
|
}
|
||||||
err = o.fs.pacer.CallNoRetry(func() (bool, error) {
|
err = o.fs.pacer.CallNoRetry(func() (bool, error) {
|
||||||
resp, err = o.fs.srv.CallJSON(&opts, nil, &info)
|
resp, err = o.fs.srv.CallJSON(&opts, nil, &info)
|
||||||
return shouldRetry(resp, err)
|
return shouldRetry(resp, err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue