Skip to content

Commit a8d1c0d

Browse files
authored
fix(‎drivers/quark_uc_tv) : Update error code judgment (OpenListTeam#2080)
* fix error code * add ErrorInfo check
1 parent 8431c1b commit a8d1c0d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/quark_uc_tv/util.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"errors"
99
"net/http"
1010
"strconv"
11+
"strings"
1112
"time"
1213

1314
"github.com/OpenListTeam/OpenList/v4/internal/model"
@@ -70,8 +71,16 @@ func (d *QuarkUCTV) request(ctx context.Context, pathname string, method string,
7071
return nil, err
7172
}
7273
// 判断 是否需要 刷新 access_token
73-
if e.Status == -1 && e.Errno == 10001 {
74-
// token 过期
74+
errInfoLower := strings.ToLower(strings.TrimSpace(e.ErrorInfo))
75+
maybeTokenInvalid :=
76+
(e.Status == -1 && (e.Errno == 10001 || e.Errno == 11001)) ||
77+
(errInfoLower != "" &&
78+
(strings.Contains(errInfoLower, "access token") ||
79+
strings.Contains(errInfoLower, "access_token") ||
80+
strings.Contains(errInfoLower, "token无效") ||
81+
strings.Contains(errInfoLower, "token 无效")))
82+
if maybeTokenInvalid {
83+
// token 过期 / 无效
7584
err = d.getRefreshTokenByTV(ctx, d.Addition.RefreshToken, true)
7685
if err != nil {
7786
return nil, err

0 commit comments

Comments
 (0)