mirror of
https://github.com/rclone/rclone.git
synced 2025-01-10 16:28:30 +01:00
drive: fix range requests on 0 length files
Before this change a range request on a 0 length file would fail $ rclone cat --head 128 drive:test/emptyfile ERROR : open file failed: googleapi: Error 416: Request range not satisfiable, requestedRangeNotSatisfiable To fix this we remove Range: headers on requests for zero length files.
This commit is contained in:
parent
58d9a3e1b5
commit
415eeca6cf
@ -2436,6 +2436,10 @@ func (o *baseObject) httpResponse(url, method string, options []fs.OpenOption) (
|
||||
return req, nil, err
|
||||
}
|
||||
fs.OpenOptionAddHTTPHeaders(req.Header, options)
|
||||
if o.bytes == 0 {
|
||||
// Don't supply range requests for 0 length objects as they always fail
|
||||
delete(req.Header, "Range")
|
||||
}
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
res, err = o.fs.client.Do(req)
|
||||
if err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user