fix(certs): default to active certs when no search term #2

Merged
supportgsc merged 1 commits from fix/certs-list-default into main 2026-06-01 10:14:17 +00:00
Showing only changes of commit 30268db4be - Show all commits

View File

@@ -38,6 +38,15 @@ func (s *CertificateService) ListCertificates(search string, limit int) ([]types
Value: search,
Operation: "LIKE",
})
} else {
// EJBCA rejects an empty criteria list ("Invalid criteria value,
// cannot be empty"). With no search term, default to listing active
// certificates so GET /certs returns a useful result instead of 500.
criteria = append(criteria, client.CertSearchCriterion{
Property: "STATUS",
Value: "CERT_ACTIVE",
Operation: "EQUAL",
})
}
certs, err := s.client.SearchCertificates(&client.CertSearchRequest{