From 3dad6ee3a25b3c88629c442c921bf1102962b055 Mon Sep 17 00:00:00 2001 From: Marcus Ramberg Date: Tue, 22 Oct 2024 23:17:04 +0200 Subject: [PATCH] fix: return after throwing internal status error to avoid trying to write response twice --- pkg/action/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/action/server.go b/pkg/action/server.go index fbf09ceb..35bfec92 100644 --- a/pkg/action/server.go +++ b/pkg/action/server.go @@ -226,6 +226,7 @@ func handler(cfg *config.Config, db store.Store, logger *slog.Logger, client *gi w.WriteHeader(http.StatusInternalServerError) io.WriteString(w, http.StatusText(http.StatusInternalServerError)) + return } payload, err := github.ValidatePayload( @@ -241,6 +242,7 @@ func handler(cfg *config.Config, db store.Store, logger *slog.Logger, client *gi w.WriteHeader(http.StatusInternalServerError) io.WriteString(w, http.StatusText(http.StatusInternalServerError)) + return } event, err := github.ParseWebHook( @@ -256,6 +258,7 @@ func handler(cfg *config.Config, db store.Store, logger *slog.Logger, client *gi w.WriteHeader(http.StatusInternalServerError) io.WriteString(w, http.StatusText(http.StatusInternalServerError)) + return } switch event := event.(type) {