From 9f5d29846b515283013e3ef180fc31e68163ffec Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 11 Aug 2023 15:35:44 +0200 Subject: [PATCH 1/3] Fix tool test inputs with multiple locations --- lib/galaxy/tools/test.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/tools/test.py b/lib/galaxy/tools/test.py index 695f6c9ef7f..f440e5ff3cd 100644 --- a/lib/galaxy/tools/test.py +++ b/lib/galaxy/tools/test.py @@ -183,16 +183,25 @@ def _process_raw_inputs( param_value = raw_input_dict["value"] param_extra = raw_input_dict["attributes"] location = param_extra.get("location") - if param_value is None and location: - # If no value is given, we try to get the file name directly from the URL - param_value = os.path.basename(location) if not value.type == "text": param_value = _split_if_str(param_value) if isinstance(value, galaxy.tools.parameters.basic.DataToolParameter): - if not isinstance(param_value, list): - param_value = [param_value] - for v in param_value: - _add_uploaded_dataset(context.for_state(), v, param_extra, value, required_files) + if param_value is None and location: + # We get the input/s from the location which can be a list of urls separated by commas + locations = _split_if_str(location) + param_value = [] + for location in locations: + v = os.path.basename(location) + param_value.append(v) + # param_extra should contain only the corresponding location + extra = dict(param_extra) + extra["location"] = location + _add_uploaded_dataset(context.for_state(), v, extra, value, required_files) + else: + if not isinstance(param_value, list): + param_value = [param_value] + for v in param_value: + _add_uploaded_dataset(context.for_state(), v, param_extra, value, required_files) processed_value = param_value elif isinstance(value, galaxy.tools.parameters.basic.DataCollectionToolParameter): assert "collection" in param_extra From 70c467b90ef3245bcf0a6b597e5600fc62bae925 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:26:42 +0200 Subject: [PATCH 2/3] Fix location in collections --- lib/galaxy/tool_util/parser/xml.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/galaxy/tool_util/parser/xml.py b/lib/galaxy/tool_util/parser/xml.py index 1b854c5b993..9b8b70ef687 100644 --- a/lib/galaxy/tool_util/parser/xml.py +++ b/lib/galaxy/tool_util/parser/xml.py @@ -864,6 +864,9 @@ def __parse_param_elem(param_elem, i=0): else: value = None + if value is None and attrib.get("location", None) is not None: + value = os.path.basename(attrib["location"]) + children_elem = param_elem if children_elem is not None: # At this time, we can assume having children only From 9e193ef1e1b2ea6ba00f5282884c7a933223d609 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:33:10 +0200 Subject: [PATCH 3/3] Consider multiple locations only with multiple=true --- lib/galaxy/tools/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/test.py b/lib/galaxy/tools/test.py index f440e5ff3cd..ab3de3cf6ed 100644 --- a/lib/galaxy/tools/test.py +++ b/lib/galaxy/tools/test.py @@ -186,7 +186,7 @@ def _process_raw_inputs( if not value.type == "text": param_value = _split_if_str(param_value) if isinstance(value, galaxy.tools.parameters.basic.DataToolParameter): - if param_value is None and location: + if location and value.multiple: # We get the input/s from the location which can be a list of urls separated by commas locations = _split_if_str(location) param_value = []