fix(cloudreve_v4): update request handling to prevent token refresh loop
This commit is contained in:
parent
cad51cf892
commit
c788ae38bd
@ -76,7 +76,7 @@ func (d *CloudreveV4) List(ctx context.Context, dir model.Obj, args model.ListAr
|
||||
err := d.request(http.MethodGet, "/file/info", func(req *resty.Request) {
|
||||
req.SetQueryParam("uri", src.Path)
|
||||
req.SetQueryParam("folder_summary", "true")
|
||||
}, &r)
|
||||
}, &ds)
|
||||
if err == nil && ds.FolderSummary.Size > 0 {
|
||||
src.Size = ds.FolderSummary.Size
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ func (d *CloudreveV4) request(method string, path string, callback base.ReqCallb
|
||||
}
|
||||
|
||||
if r.Code != 0 {
|
||||
if r.Code == 401 && d.RefreshToken != "" {
|
||||
if r.Code == 401 && d.RefreshToken != "" && path != "/session/token/refresh" {
|
||||
// try to refresh token
|
||||
err = d.refreshToken()
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user