From 56fe8071c4cb3157c794daede0afbfcb727adff3 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sun, 25 Oct 2026 22:05:34 +1100 Subject: [PATCH] fix(webui): treat the epoch export start as any time --- internal/webui/api_audit.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/webui/api_audit.go b/internal/webui/api_audit.go index cc55efa47..a3cad6025 100644 --- a/internal/webui/api_audit.go +++ b/internal/webui/api_audit.go @@ -230,10 +230,21 @@ func auditExportFormat(r *http.Request) (string, bool) { return "", false } +// auditExportAllTime is the "any time" sentinel the dashboard sends for +// from. An export from the epoch is bounded by the page cap and deadline +// instead of the usual year. +var auditExportAllTime = time.Unix(0, 0).UTC() + // auditExportRange requires an explicit window of at most a year: an unbounded // export would stream the instance's whole history. func auditExportRange(filter audit.Filter) error { - if filter.From.IsZero() || filter.To.IsZero() || filter.To.Sub(filter.From) > auditExportMaxRange { + if filter.From.IsZero() || filter.To.IsZero() { + return errors.New("choose an export time range of 366 days or less") + } + if filter.From.Equal(auditExportAllTime) { + return nil + } + if filter.To.Sub(filter.From) > auditExportMaxRange { return errors.New("choose an export time range of 366 days or less") } return nil