mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 17:02:43 +00:00
fix: handle 'not found' errors as 404 in CRL/OCSP handlers
The error routing only checked for "issuer not found" but not "certificate not found", causing cert-not-found errors to fall through to a generic 500. Broadened the check to match any "not found" error string for both CRL and OCSP handlers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -464,7 +464,7 @@ func (h CertificateHandler) GetDERCRL(w http.ResponseWriter, r *http.Request) {
|
||||
derBytes, err := h.svc.GenerateDERCRL(issuerID)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
if strings.Contains(errMsg, "issuer not found") {
|
||||
if strings.Contains(errMsg, "not found") {
|
||||
Error(w, http.StatusNotFound, errMsg)
|
||||
return
|
||||
}
|
||||
@@ -504,7 +504,7 @@ func (h CertificateHandler) HandleOCSP(w http.ResponseWriter, r *http.Request) {
|
||||
derBytes, err := h.svc.GetOCSPResponse(issuerID, serialHex)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
if strings.Contains(errMsg, "issuer not found") {
|
||||
if strings.Contains(errMsg, "not found") {
|
||||
Error(w, http.StatusNotFound, errMsg)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user