🐛 When maxListCount limit is not reached, the wrong pop-up box prompts a maxListCount error (#8846)

box.Ls(path) will count the same document repeatedly (x/x.sy).
Before checking maxListCount limit, assign len(ret) to the totals variable so that it only represents the number of .sy documents
This commit is contained in:
Candyメ奶糖 2023-07-29 09:43:21 +08:00 committed by GitHub
parent 53db7e22d4
commit 0c621de5d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -387,6 +387,7 @@ func ListDocTree(boxID, path string, sortMode int, flashcard bool, maxListCount
return fileTreeFiles[i].Sort < fileTreeFiles[j].Sort
})
ret = append(ret, fileTreeFiles...)
totals = len(ret)
if maxListCount < len(ret) {
ret = ret[:maxListCount]
}
@ -414,6 +415,7 @@ func ListDocTree(boxID, path string, sortMode int, flashcard bool, maxListCount
ret = append(ret, docs...)
}
totals = len(ret)
if maxListCount < len(ret) {
ret = ret[:maxListCount]
}