fix(alist_v3): api error pass (close #3326)

pull/3539/head
Andy Hsu 2023-02-20 16:15:52 +08:00
parent 40b26a81a0
commit 09492193c4
2 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package alist_v3
import (
"context"
"errors"
"io"
"path"
"strconv"
@ -55,6 +56,9 @@ func (d *AListV3) List(ctx context.Context, dir model.Obj, args model.ListArgs)
if err != nil {
return nil, err
}
if resp.Code != 200 {
return nil, errors.New(resp.Message)
}
var files []model.Obj
for _, f := range resp.Data.Content {
file := model.ObjThumb{
@ -84,6 +88,9 @@ func (d *AListV3) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
if err != nil {
return nil, err
}
if resp.Code != 200 {
return nil, errors.New(resp.Message)
}
return &model.Link{
URL: resp.Data.RawURL,
}, nil

View File

@ -10,7 +10,7 @@ func checkResp(resp common.Resp[interface{}], err error) error {
if err != nil {
return err
}
if resp.Message == "success" {
if resp.Code == 200 {
return nil
}
return errors.New(resp.Message)