精简启动横幅日志并保证历史过滤分页准确
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-09 00:39:01 +08:00
1 parent 0dc459d50a
commit ea2808f72b
7 files changed
+198 -11

No files matched your search

+8 -3
View File
@@ -72,16 +72,21 @@ func (w *Writer) Read(ctx context.Context, name string, offset, limit int) (Page
if at.Before(cutoff) {
return nil
}
// 先过滤再分页,偏移、统计和下一页判断均按实际可见记录计算。
visible, keep := presentLine(string(line))
if !keep {
return nil
}
position++
if position <= offset {
return nil
}
if len(page.Lines) >= limit || bytes+len(line) > maxResponseBytes {
if len(page.Lines) >= limit || bytes+len(visible) > maxResponseBytes {
page.HasMore = true
return finished
}
page.Lines = append(page.Lines, string(line))
bytes += len(line)
page.Lines = append(page.Lines, visible)
bytes += len(visible)
return nil
})
if errors.Is(err, finished) {