From 646613a7cde9fc8a09adc435914f2a9370b071eb Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Wed, 15 Nov 2023 20:40:49 -0600 Subject: [PATCH] backend: throw error if name is empty for `PUT /api/workflows/{id}` This is handled at the frontend in the editor to prevent this, but still add additional check in backend --- client/src/components/Workflow/Editor/Index.vue | 13 ++++++------- lib/galaxy/webapps/galaxy/api/workflows.py | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index 73494320a0fa..266c24af9e68 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -617,13 +617,12 @@ export default { ); } } catch (e) { - this.onWorkflowError("Creating workflow failed"), - e || "Please contact an administrator.", - { - Ok: () => { - this.hideModal(); - }, - }; + const response = e.response.data.err_msg || e || "Please contact an administrator."; + this.onWorkflowError("Creating workflow failed", response, { + Ok: () => { + this.hideModal(); + }, + }); } }, nameValidate() { diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index 508b2e481887..e5211ecd062b 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -472,6 +472,8 @@ def update(self, trans: GalaxyWebTransaction, id, payload, **kwds): new_workflow_name = workflow_dict.get("name") old_workflow = stored_workflow.latest_workflow name_updated = new_workflow_name and new_workflow_name != stored_workflow.name + if not name_updated: + raise exceptions.MessageException("Please provide a workflow name.") steps_updated = "steps" in workflow_dict if name_updated and not steps_updated: sanitized_name = sanitize_html(new_workflow_name or old_workflow.name)