Alerting: Make pagination token empty if an invalid token is passed (#99644)

Reset token to empty if invalid
This commit is contained in:
Fayzal Ghantiwala
2025-01-28 11:54:11 +00:00
committed by GitHub
parent 1cc9f8f0c2
commit f8e7e9e024
2 changed files with 15 additions and 3 deletions
@@ -334,6 +334,11 @@ func PrepareRuleGroupStatuses(log log.Logger, manager state.AlertInstanceManager
maxGroups := getInt64WithDefault(opts.Query, "group_limit", -1)
nextToken := opts.Query.Get("group_next_token")
if nextToken != "" {
if _, err := base64.URLEncoding.DecodeString(nextToken); err != nil {
nextToken = ""
}
}
groupedRules := getGroupedRules(log, ruleList, ruleNamesSet, opts.Namespaces)
rulesTotals := make(map[string]int64, len(groupedRules))