From d53eecc2292e84681e8a8e8641125b52f8c88954 Mon Sep 17 00:00:00 2001 From: Jiang Xiang <869914918@qq.com> Date: Thu, 30 Jan 2025 11:24:07 +0800 Subject: [PATCH 1/2] fix(febbox): panic due to slice out of range (#7898 close #7889) --- drivers/febbox/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/febbox/util.go b/drivers/febbox/util.go index ac072edbde89..ad2efe070e11 100644 --- a/drivers/febbox/util.go +++ b/drivers/febbox/util.go @@ -3,6 +3,7 @@ package febbox import ( "encoding/json" "errors" + "fmt" "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/op" "github.com/go-resty/resty/v2" @@ -135,6 +136,9 @@ func (d *FebBox) getDownloadLink(id string, ip string) (string, error) { if err = json.Unmarshal(res, &fileDownloadResp); err != nil { return "", err } + if len(fileDownloadResp.Data) == 0 { + return "", fmt.Errorf("can not get download link, code:%d, msg:%s", fileDownloadResp.Code, fileDownloadResp.Msg) + } return fileDownloadResp.Data[0].DownloadURL, nil } From b9f397d29f0a4e75c72564da40d0f297ed8c5626 Mon Sep 17 00:00:00 2001 From: abc1763613206 Date: Thu, 30 Jan 2025 11:25:41 +0800 Subject: [PATCH 2/2] fix(139): restore the `Account` handling, partially reverts #7850 (#7900 close #7784) --- drivers/139/driver.go | 47 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/139/driver.go b/drivers/139/driver.go index cf64a8fdb7d0..1e2ba9c4d52e 100644 --- a/drivers/139/driver.go +++ b/drivers/139/driver.go @@ -2,11 +2,13 @@ package _139 import ( "context" + "encoding/base64" "fmt" "io" "net/http" "path" "strconv" + "strings" "time" "github.com/alist-org/alist/v3/drivers/base" @@ -69,29 +71,28 @@ func (d *Yun139) Init(ctx context.Context) error { default: return errs.NotImplement } - // if d.ref != nil { - // return nil - // } - // decode, err := base64.StdEncoding.DecodeString(d.Authorization) - // if err != nil { - // return err - // } - // decodeStr := string(decode) - // splits := strings.Split(decodeStr, ":") - // if len(splits) < 2 { - // return fmt.Errorf("authorization is invalid, splits < 2") - // } - // d.Account = splits[1] - // _, err = d.post("/orchestration/personalCloud/user/v1.0/qryUserExternInfo", base.Json{ - // "qryUserExternInfoReq": base.Json{ - // "commonAccountInfo": base.Json{ - // "account": d.getAccount(), - // "accountType": 1, - // }, - // }, - // }, nil) - // return err - return nil + if d.ref != nil { + return nil + } + decode, err := base64.StdEncoding.DecodeString(d.Authorization) + if err != nil { + return err + } + decodeStr := string(decode) + splits := strings.Split(decodeStr, ":") + if len(splits) < 2 { + return fmt.Errorf("authorization is invalid, splits < 2") + } + d.Account = splits[1] + _, err = d.post("/orchestration/personalCloud/user/v1.0/qryUserExternInfo", base.Json{ + "qryUserExternInfoReq": base.Json{ + "commonAccountInfo": base.Json{ + "account": d.getAccount(), + "accountType": 1, + }, + }, + }, nil) + return err } func (d *Yun139) InitReference(storage driver.Driver) error {