diff --git a/lib/galaxy/webapps/galaxy/services/tools.py b/lib/galaxy/webapps/galaxy/services/tools.py index 2269a15efb22..853ce70925f0 100644 --- a/lib/galaxy/webapps/galaxy/services/tools.py +++ b/lib/galaxy/webapps/galaxy/services/tools.py @@ -270,6 +270,8 @@ def _handle_inputs_output_to_api_response(self, trans, tool, target_history, var output_dict["output_name"] = output_name outputs.append(output_dict) + trans.security.encode_all_ids(rval, recursive=True) + for output_name, collection_instance in vars.get("output_collections", []): history = target_history or trans.history output_dict = dictify_dataset_collection_instance( @@ -292,8 +294,6 @@ def _handle_inputs_output_to_api_response(self, trans, tool, target_history, var output_dict["output_name"] = output_name rval["implicit_collections"].append(output_dict) - trans.security.encode_all_ids(rval, recursive=True) - # Encoding the job ids is handled by the pydantic model for job in vars.get("jobs", []): rval["jobs"].append(job.to_dict(view="collection"))