fix(webui): treat the epoch export start as any time
This commit is contained in:
1 file changed
+12
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user