fix(cloudreve_v4): update request handling to prevent token refresh loop

This commit is contained in:
MadDogOwner 2025-05-03 18:23:37 +08:00
parent cad51cf892
commit c788ae38bd
No known key found for this signature in database
GPG Key ID: 0730AD911EB33562
2 changed files with 2 additions and 2 deletions

View File

@ -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
}

View File

@ -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 {