fix: screenshots total count

This commit is contained in:
2024-10-21 03:13:10 +03:00
parent d21f159346
commit addcfe0942

View File

@@ -47,14 +47,10 @@ func NewScreenshotsDirFromPath(path string, limit int) ScreenshotCollection {
if err != nil {
return s
}
s.TotalCount = len(files)
for i, f := range files {
if f.IsDir() {
continue
}
if limit > 0 && i >= limit {
break
}
path := fmt.Sprintf("%s/%s", path, f.Name())
// s.Screenshots = append(s.Screenshots, fmt.Sprintf("%s/%s", path, f.Name()))
// convert to base64
@@ -77,6 +73,10 @@ func NewScreenshotsDirFromPath(path string, limit int) ScreenshotCollection {
default:
continue
}
s.TotalCount++
if limit > 0 && i >= limit {
continue
}
b64 += base64.StdEncoding.EncodeToString(bytes)
entry := ScreenshotEntry{
Dir: filepath.Dir(path),