fix: 修复文件列表总共条数显示问题 (#952)

This commit is contained in:
zhengkunwang223 2023-05-09 15:17:47 +08:00 committed by GitHub
parent 149c26728c
commit 2b23523bec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,7 +113,6 @@ func (f *FileInfo) search(search string, count int) (files []FileSearchInfo, tot
scanner := bufio.NewScanner(output) scanner := bufio.NewScanner(output)
for scanner.Scan() { for scanner.Scan() {
line := scanner.Text() line := scanner.Text()
fmt.Println(line)
info, err := os.Stat(line) info, err := os.Stat(line)
if err != nil { if err != nil {
continue continue
@ -159,8 +158,6 @@ func (f *FileInfo) listChildren(dir, showHidden, containSub bool, search string,
} }
} }
f.ItemTotal = 0
var items []*FileInfo var items []*FileInfo
for _, df := range files { for _, df := range files {
if dir && !df.IsDir() { if dir && !df.IsDir() {
@ -222,7 +219,9 @@ func (f *FileInfo) listChildren(dir, showHidden, containSub bool, search string,
} }
items = append(items, file) items = append(items, file)
} }
f.ItemTotal = total if containSub {
f.ItemTotal = total
}
start := (page - 1) * pageSize start := (page - 1) * pageSize
end := pageSize + start end := pageSize + start
var result []*FileInfo var result []*FileInfo