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 cb889d41f2
commit 0dd6f17797

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)