Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions drivers/onedrive/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ func (d *Onedrive) Request(url string, method string, callback base.ReqCallback,
if err != nil {
return nil, err
}
return d.Request(url, method, callback, resp)
// retry once with the refreshed token, never loop on a bad token
return d.Request(url, method, callback, resp, true)
}
return nil, errors.New(e.Error.Message)
}
Expand Down Expand Up @@ -310,7 +311,7 @@ func (d *Onedrive) getDrive(ctx context.Context) (*DriveResp, error) {
var resp DriveResp
_, err := d.Request(api, http.MethodGet, func(req *resty.Request) {
req.SetContext(ctx)
}, &resp, true)
}, &resp)
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/onedrive_app/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func (d *OnedriveAPP) Request(url string, method string, callback base.ReqCallba
if err != nil {
return nil, err
}
return d.Request(url, method, callback, resp)
// retry once with the refreshed token, never loop on a bad token
return d.Request(url, method, callback, resp, true)
}
return nil, errors.New(e.Error.Message)
}
Expand Down Expand Up @@ -217,7 +218,7 @@ func (d *OnedriveAPP) getDrive(ctx context.Context) (*DriveResp, error) {
var resp DriveResp
_, err := d.Request(api, http.MethodGet, func(req *resty.Request) {
req.SetContext(ctx)
}, &resp, true)
}, &resp)
if err != nil {
return nil, err
}
Expand Down
Loading