gitness icon indicating copy to clipboard operation
gitness copied to clipboard

& symbol in parameters gets stripped

Open andrii-kasparevych opened this issue 3 years ago • 2 comments

Drone strips everything around '&' symbol when used a parameter value. E.g. I want to pass a URL with query parameters like https://example.com/api/doStuff?param1=1&param2=2 as a parameter to a custom build, and the part &param2=2 gets stripped. image

Original thread: https://harnesscommunity.slack.com/archives/C028FPGCPF0/p1663606196367199

andrii-kasparevych avatar Sep 20 '22 14:09 andrii-kasparevych

@andrii-kasparevych thanks for raising an issue✊ Our team is reviewing and I will keep you up to date if anything changes.

ShruthiHubb avatar Sep 21 '22 12:09 ShruthiHubb

It's not striped, it's still there, but it's called param2 :)

Explanation: From UI, it calls the drone API like: https://droneserver.come/repos/x/xbuilds?branch=master&my_param=https://example.com/api/doStuff?param1=1&param2=2 The parameters are sent as query strings.

In the code it goes through each query param and sets the value. The raw query will look like this branch=master&my_param=https://example.com/api/doStuff?param1=1&param2=2.

The issue is that & is treated as a new query value so env variables will be set like branch=master my_param=https://example.com/api/doStuff?param1=1 param2=2

Suggestion: Use separate parameters in drone UI as params and in the pipeline create the final URL: - echo ${my_param}?${param1}&${param2}

MarinX avatar Sep 29 '22 18:09 MarinX