diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 97d20f66d0c..cec66a6eb14 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1361,9 +1361,12 @@ class ColumnListParameter(SelectToolParameter): legal_values = self.get_column_list(trans, other_values) value = other_values.get(self.name) - if value is not None and value not in legal_values and self.is_file_empty(trans, other_values): - value = value if isinstance(value, list) else [value] - legal_values.extend(value) + if value is not None: + # There are cases where 'value' is a string of comma separated values. This ensures + # that it is converted into a list, with extra whitespace around items removed. + value = util.listify(value, do_strip=True) + if not set(value).issubset(set(legal_values)) and self.is_file_empty(trans, other_values): + legal_values.extend(value) return set(legal_values) diff --git a/lib/galaxy_test/api/test_workflows.py b/lib/galaxy_test/api/test_workflows.py index 4df8803c0bf..9e609f39477 100644 --- a/lib/galaxy_test/api/test_workflows.py +++ b/lib/galaxy_test/api/test_workflows.py @@ -1193,6 +1193,46 @@ steps: invocation_id = self.__invoke_workflow(history_id, workflow_id, inputs) self.wait_for_invocation_and_jobs(history_id, workflow_id, invocation_id) + @skip_without_tool('column_param') + def test_empty_file_data_column_specified(self): + # Regression test for https://github.com/galaxyproject/galaxy/pull/10981 + with self.dataset_populator.test_history() as history_id: + self._run_jobs("""class: GalaxyWorkflow +steps: + empty_output: + tool_id: empty_output + outputs: + out_file1: + change_datatype: tabular + column_param: + tool_id: column_param + in: + input1: empty_output/out_file1 + state: + col: 2 + col_names: 'B' +""", history_id=history_id) + + @skip_without_tool('column_param_list') + def test_comma_separated_columns(self): + # Regression test for https://github.com/galaxyproject/galaxy/pull/10981 + with self.dataset_populator.test_history() as history_id: + self._run_jobs("""class: GalaxyWorkflow +steps: + empty_output: + tool_id: empty_output + outputs: + out_file1: + change_datatype: tabular + column_param_list: + tool_id: column_param_list + in: + input1: empty_output/out_file1 + state: + col: '2,3' + col_names: 'B' +""", history_id=history_id) + @skip_without_tool("mapper") @skip_without_tool("pileup") def test_workflow_metadata_validation_0(self): diff --git a/test/functional/tools/column_param_list.xml b/test/functional/tools/column_param_list.xml new file mode 100644 index 00000000000..a3c8d99e4f6 --- /dev/null +++ b/test/functional/tools/column_param_list.xml @@ -0,0 +1,50 @@ + + '$output1' && +echo "col $col" > '$output2' && +echo "col_names $col_names" >> '$output2' + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index b01cd8f42af..1a53ca33bf6 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -114,6 +114,7 @@ +