Merge pull request 'fix(certs): default to active certs when no search term' (#2) from fix/certs-list-default into main
This commit was merged in pull request #2.
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user