From eef015d4e29c3df78fe96ebaed81c47034670aa5 Mon Sep 17 00:00:00 2001 From: Wolfgang Maier Date: Fri, 9 Feb 2024 09:14:20 +0100 Subject: [PATCH] Preserve original request params as nested dict and use them in final POST request --- lib/galaxy/webapps/galaxy/controllers/async.py | 4 +++- lib/galaxy/webapps/galaxy/controllers/tool_runner.py | 3 +++ tools/data_source/data_source.py | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/async.py b/lib/galaxy/webapps/galaxy/controllers/async.py index c1a625dc4bb..c17e1c07a66 100644 --- a/lib/galaxy/webapps/galaxy/controllers/async.py +++ b/lib/galaxy/webapps/galaxy/controllers/async.py @@ -69,7 +69,8 @@ class ASync(BaseUIController): # ignore any other params that may have been passed by the remote # server with the exception of STATUS and URL; # if name, info, dbkey and data_type are not handled via incoming params, - # use the metadata from the already existing dataset + # use the metadata from the already existing dataset; + # preserve original params under nested dict params_dict = dict( STATUS=params.STATUS, URL=params.URL, @@ -77,6 +78,7 @@ class ASync(BaseUIController): info=data.info, dbkey=data.dbkey, data_type=data.ext, + incoming_request_params=params.__dict__.copy(), ) if tool.input_translator: tool.input_translator.translate(params) diff --git a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py index bf078054ae9..d32418721d4 100644 --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -77,6 +77,9 @@ class ToolRunner(BaseUIController): # execute tool without displaying form (used for datasource tools) params = galaxy.util.Params(kwd, sanitize=False) + if tool.tool_type == "data_source": + # preserve original params sent by the remote server as extra dict + params.update({"incoming_request_params": params.__dict__.copy()}) # do param translation here, used by datasource tools if tool.input_translator: tool.input_translator.translate(params) diff --git a/tools/data_source/data_source.py b/tools/data_source/data_source.py index 971ef58fdf6..fba58ba1cf9 100644 --- a/tools/data_source/data_source.py +++ b/tools/data_source/data_source.py @@ -55,7 +55,11 @@ def __main__(): if URL_method == "get": page = urlopen(cur_URL, timeout=DEFAULT_SOCKET_TIMEOUT) elif URL_method == "post": - page = urlopen(cur_URL, urlencode(params["param_dict"]).encode("utf-8"), timeout=DEFAULT_SOCKET_TIMEOUT) + page = urlopen( + cur_URL, + urlencode(params["param_dict"]["incoming_request_params"]).encode("utf-8"), + timeout=DEFAULT_SOCKET_TIMEOUT + ) except Exception as e: sys.exit("The remote data source application may be off line, please try again later. Error: %s" % str(e)) if max_file_size: