Fix secretsencryption request handler panic

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson
2025-05-14 19:14:42 +00:00
committed by Brad Davidson
parent e76ff3251f
commit 8a8c10f542

View File

@@ -192,6 +192,12 @@ func EncryptionConfig(ctx context.Context, control *config.Control) http.Handler
util.SendError(fmt.Errorf("method not allowed"), resp, req, http.StatusMethodNotAllowed)
return
}
if control.Runtime.Core == nil {
util.SendError(util.ErrCoreNotReady, resp, req, http.StatusServiceUnavailable)
return
}
encryptReq, err := getEncryptionRequest(req)
if err != nil {
util.SendError(err, resp, req, http.StatusBadRequest)