mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
onedrive: fix RangeOption support in Open #1825
This commit is contained in:
parent
9c45125271
commit
c963c74fbe
@ -1065,6 +1065,18 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {
|
||||
if o.id == "" {
|
||||
return nil, errors.New("can't download - no id")
|
||||
}
|
||||
for i := range options {
|
||||
option := options[i]
|
||||
if x, ok := option.(*fs.RangeOption); ok {
|
||||
// Fix RangeOption if requesting a fetch from
|
||||
// the end as it doesn't work with Onedrive.
|
||||
// If start is < 0 then fetch from the end
|
||||
if x.Start < 0 {
|
||||
x = &fs.RangeOption{Start: o.size - x.End, End: -1}
|
||||
options[i] = x
|
||||
}
|
||||
}
|
||||
}
|
||||
var resp *http.Response
|
||||
opts := rest.Opts{
|
||||
Method: "GET",
|
||||
|
Loading…
Reference in New Issue
Block a user