Skip to content

Commit

Permalink
backend: throw error if name is empty for PUT /api/workflows/{id}
Browse files Browse the repository at this point in the history
This is handled at the frontend in the editor to prevent this,
but still add additional check in backend
  • Loading branch information
ahmedhamidawan committed Nov 16, 2023
1 parent c0132f6 commit 646613a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 6 additions & 7 deletions client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions lib/galaxy/webapps/galaxy/api/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 646613a

Please sign in to comment.