diff --git a/engine/api/workflow.go b/engine/api/workflow.go index c6247b0e46..55d15a45c6 100644 --- a/engine/api/workflow.go +++ b/engine/api/workflow.go @@ -219,6 +219,9 @@ func (api *API) getWorkflowHandler() service.Handler { vars := mux.Vars(r) key := vars["key"] name := vars["permWorkflowNameAdvanced"] + if name == "" { + name = vars["permWorkflowName"] // Useful for workflowv3 routes + } withUsage := service.FormBool(r, "withUsage") withAudits := service.FormBool(r, "withAudits") withLabels := service.FormBool(r, "withLabels") diff --git a/engine/api/workflow/dao.go b/engine/api/workflow/dao.go index 11a31b4f1f..c55f19489e 100644 --- a/engine/api/workflow/dao.go +++ b/engine/api/workflow/dao.go @@ -257,6 +257,10 @@ func Load(ctx context.Context, db gorp.SqlExecutor, _ cache.Store, proj sdk.Proj ctx, end := telemetry.Span(ctx, "workflow.Load") defer end() + if name == "" { + return nil, sdk.NewErrorFrom(sdk.ErrInvalidData, "invalid given workflow name") + } + dao := opts.GetWorkflowDAO() dao.Filters.ProjectKey = proj.Key dao.Filters.WorkflowName = name diff --git a/engine/api/workflow_run.go b/engine/api/workflow_run.go index 76f788092d..be98fa6d49 100644 --- a/engine/api/workflow_run.go +++ b/engine/api/workflow_run.go @@ -266,6 +266,9 @@ func (api *API) getWorkflowRunHandler() service.Handler { vars := mux.Vars(r) key := vars["key"] name := vars["permWorkflowNameAdvanced"] + if name == "" { + name = vars["permWorkflowName"] // Useful for workflowv3 routes + } number, err := requestVarInt(r, "number") if err != nil { return err