浏览代码

:bug: 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
Candyメ奶糖 2 年之前
父节点
当前提交
0c621de5d9
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      kernel/model/file.go

+ 2 - 0
kernel/model/file.go

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