diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index b1da73f586ab..188d5a4b92f4 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -413,21 +413,16 @@ def update_workflow_from_raw_description(self, trans, stored_workflow, raw_workf errors.append("Step %i: Requires tool '%s'." % (int(missing_tool_tup[3]) + 1, missing_tool_tup[0])) raise MissingToolsException(workflow, errors) - as_dict = raw_workflow_description.as_dict - if 'name' in as_dict: - sanitized_name = sanitize_html(as_dict['name']) - workflow.name = sanitized_name - stored_workflow.name = sanitized_name - # Connect up workflow.stored_workflow = stored_workflow stored_workflow.latest_workflow = workflow - # I'm not sure we can't just default this to True. - if kwds.get("update_stored_workflow_attributes", False): + if kwds.get("update_stored_workflow_attributes", True): update_dict = raw_workflow_description.as_dict if 'name' in update_dict: - stored_workflow.name = update_dict['name'] + sanitized_name = sanitize_html(update_dict['name']) + workflow.name = sanitized_name + stored_workflow.name = sanitized_name if 'annotation' in update_dict: newAnnotation = sanitize_html(update_dict['annotation']) self.add_item_annotation(trans.sa_session, stored_workflow.user, stored_workflow, newAnnotation) @@ -1425,7 +1420,6 @@ def refactor(self, trans, stored_workflow, refactor_request): stored_workflow, raw_workflow_description, fill_defaults=True, - update_stored_workflow_attributes=True, ) diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index 662858883c04..ea142128f7fa 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -598,7 +598,7 @@ def update(self, trans, id, payload, **kwds): stored_workflow.published = workflow_dict['published'] trans.sa_session.flush() - if 'annotation' in workflow_dict: + if 'annotation' in workflow_dict and not steps_updated: newAnnotation = sanitize_html(workflow_dict['annotation']) self.add_item_annotation(trans.sa_session, trans.get_user(), stored_workflow, newAnnotation) trans.sa_session.flush() diff --git a/lib/galaxy/webapps/galaxy/controllers/workflow.py b/lib/galaxy/webapps/galaxy/controllers/workflow.py index d526ef5c8b3f..db5ab66036d3 100644 --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -609,6 +609,7 @@ def save_workflow_as(self, trans, workflow_name, workflow_data, workflow_annotat stored_workflow, workflow_data, from_tool_form=from_tool_form, + update_stored_workflow_attributes=False, # taken care of above ) except workflows.MissingToolsException as e: return dict(