Ver Fonte

Use always acme.IsErrNotFound

This commit replaces the comparisons with acme.ErrNotFound and always
uses acme.IsErrNotFound.
Mariano Cano há 2 anos atrás
pai
commit
b1e31b1726
2 ficheiros alterados com 2 adições e 3 exclusões
  1. 1 1
      acme/api/middleware.go
  2. 1 2
      authority/admin/api/middleware.go

+ 1 - 1
acme/api/middleware.go

@@ -247,7 +247,7 @@ func extractJWK(next nextHTTP) nextHTTP {
 		// Get Account OR continue to generate a new one OR continue Revoke with certificate private key
 		// Get Account OR continue to generate a new one OR continue Revoke with certificate private key
 		acc, err := db.GetAccountByKeyID(ctx, jwk.KeyID)
 		acc, err := db.GetAccountByKeyID(ctx, jwk.KeyID)
 		switch {
 		switch {
-		case errors.Is(err, acme.ErrNotFound):
+		case acme.IsErrNotFound(err):
 			// For NewAccount and Revoke requests ...
 			// For NewAccount and Revoke requests ...
 			break
 			break
 		case err != nil:
 		case err != nil:

+ 1 - 2
authority/admin/api/middleware.go

@@ -1,7 +1,6 @@
 package api
 package api
 
 
 import (
 import (
-	"errors"
 	"net/http"
 	"net/http"
 
 
 	"github.com/go-chi/chi/v5"
 	"github.com/go-chi/chi/v5"
@@ -125,7 +124,7 @@ func loadExternalAccountKey(next http.HandlerFunc) http.HandlerFunc {
 		}
 		}
 
 
 		if err != nil {
 		if err != nil {
-			if errors.Is(err, acme.ErrNotFound) {
+			if acme.IsErrNotFound(err) {
 				render.Error(w, admin.NewError(admin.ErrorNotFoundType, "ACME External Account Key not found"))
 				render.Error(w, admin.NewError(admin.ErrorNotFoundType, "ACME External Account Key not found"))
 				return
 				return
 			}
 			}