Commit 364e7e1f authored by mvdbeek's avatar mvdbeek
Browse files

Update name of Workflow when updating StoredWorkflow name

Fixes https://github.com/galaxyproject/galaxy/issues/6773.
parent 02c17715
......@@ -481,8 +481,15 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn
workflow_dict = payload.get('workflow') or payload
if workflow_dict:
new_workflow_name = workflow_dict.get('name') or workflow_dict.get('name')
if new_workflow_name:
stored_workflow.name = sanitize_html(new_workflow_name)
if new_workflow_name and new_workflow_name != stored_workflow.name:
sanitized_name = sanitize_html(new_workflow_name)
workflow = stored_workflow.latest_workflow.copy()
workflow.stored_workflow = stored_workflow
workflow.name = sanitized_name
stored_workflow.name = sanitized_name
stored_workflow.latest_workflow = workflow
trans.sa_session.add(workflow, stored_workflow)
trans.sa_session.flush()
if 'annotation' in workflow_dict:
newAnnotation = sanitize_html(workflow_dict['annotation'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment