Skip to content

Commit 78b203b

Browse files
authored
Merge pull request #1970 from Tomy2e/panic-conversion-webhook
🐛 Conversion webhook should not panic when conversion request is nil
2 parents c83076e + 07ba0bc commit 78b203b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/webhook/conversion/conversion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
6969
return
7070
}
7171

72+
if convertReview.Request == nil {
73+
log.Error(nil, "conversion request is nil")
74+
w.WriteHeader(http.StatusBadRequest)
75+
return
76+
}
77+
7278
// TODO(droot): may be move the conversion logic to a separate module to
7379
// decouple it from the http layer ?
7480
resp, err := wh.handleConvertRequest(convertReview.Request)

0 commit comments

Comments
 (0)