From 356a119f309fee13136d17cd3d756ce29dd4c2db Mon Sep 17 00:00:00 2001 From: Giteabot Date: Tue, 5 May 2026 10:49:17 -0700 Subject: [PATCH] fix(actions): validate workflow param to prevent 500 error (#37546) (#37554) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport #37546 by @KalashThakare This PR fixes issue #37523: 1. Prevents a 500 error on the Actions page when disabling workflows with an empty workflow parameter 2. Uses a single **ctx.JSONError** in the handler to return 400 Bad Request with the message “workflow is required” for empty input Co-authored-by: Kalash Thakare ☯︎ --- routers/web/repo/actions/view.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index f92df685fd..954abc65ce 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -949,7 +949,7 @@ func EnableWorkflowFile(ctx *context_module.Context) { func disableOrEnableWorkflowFile(ctx *context_module.Context, isEnable bool) { workflow := ctx.FormString("workflow") if len(workflow) == 0 { - ctx.ServerError("workflow", nil) + ctx.JSONError("workflow is required") return }