Skip to content

Commit

Permalink
fix(ilanzou): fix infinite loop when getting file list (#7366 close #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason-Fly authored Oct 20, 2024
1 parent 2830575 commit 48ac23c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/ilanzou/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ func (d *ILanZou) Drop(ctx context.Context) error {
}

func (d *ILanZou) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
offset := 1
var res []ListItem
for {
var resp ListResp
_, err := d.proved("/record/file/list", http.MethodGet, func(req *resty.Request) {
params := []string{
"offset=1",
"offset=" + strconv.Itoa(offset),
"limit=60",
"folderId=" + dir.GetID(),
"type=0",
Expand All @@ -83,7 +84,9 @@ func (d *ILanZou) List(ctx context.Context, dir model.Obj, args model.ListArgs)
return nil, err
}
res = append(res, resp.List...)
if resp.TotalPage <= resp.Offset {
if resp.Offset < resp.TotalPage {
offset++
} else {
break
}
}
Expand Down

0 comments on commit 48ac23c

Please sign in to comment.