Skip to content

Commit

Permalink
Make cleaning of request params profile-dependent
Browse files Browse the repository at this point in the history
as suggested by @martenson
  • Loading branch information
wm75 committed Feb 24, 2024
1 parent 2554a1b commit 41defa8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ List of behavior changes associated with profile versions:
### 24.0
- Do not use Galaxy python environment for `data_source_async` tools.
- Drop request parameters received by data source tools that are not declared in `<request_param_translation>` section.
### Examples
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2895,6 +2895,13 @@ class DataSourceTool(OutputParameterJSONTool):
tool_type = "data_source"
default_tool_action = DataSourceToolAction

@property
def wants_params_cleaned(self):
"""Indicates whether received, but undeclared request params should be cleaned."""
if self.profile < 24.0:
return False
return True

def _build_GALAXY_URL_parameter(self):
return ToolParameter.build(
self, XML(f'<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id={self.id}" />')
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/async.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def index(self, trans, tool_id=None, data_secret=None, **kwd):
translator.galaxy_name for translator in tool.input_translator.param_trans_dict.values()
}
for param in params:
if param in tool_declared_params:
if param in tool_declared_params or not tool.wants_params_cleaned:
params_dict[param] = params.get(param, None)
params = params_dict

Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/tool_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __tool_404__():
# preserve original params sent by the remote server as extra dict
# before in-place translation happens, then clean the incoming params
params.update({"incoming_request_params": params.copy()})
if tool.input_translator:
if tool.input_translator and tool.wants_params_cleaned:
for k in list(params.keys()):
if k not in tool.input_translator.vocabulary and k not in ("URL", "incoming_request_params"):
# the remote server has sent a param
Expand Down

0 comments on commit 41defa8

Please sign in to comment.