Commit e9a20105 authored by Piotr Skorupa's avatar Piotr Skorupa Committed by Mikołaj Wawrzyniak

Fix overwriting path params by query params

parent 7db1a691
......@@ -31,7 +31,7 @@ module Routing
end
end
generate_url(masked_params.merge(masked_query_params))
generate_url(masked_params.merge(params: masked_query_params))
end
private
......@@ -45,7 +45,7 @@ module Routing
elsif @request.path_parameters[:controller] == 'groups/insights'
default_root_url + "#{Gitlab::Routing.url_helpers.group_insights_path(masked_params)}"
else
Gitlab::Routing.url_helpers.url_for(masked_params.merge(masked_query_params))
Gitlab::Routing.url_helpers.url_for(masked_params)
end
end
......
......@@ -178,6 +178,26 @@ RSpec.describe ::Routing::PseudonymizationHelper do
it_behaves_like 'masked url'
end
context 'when query string has keys with the same names as path params' do
let(:masked_url) { "http://localhost/dashboard/issues?action=foobar&scope=all&state=opened" }
let(:request) do
double(:Request,
path_parameters: {
controller: 'dashboard',
action: 'issues'
},
protocol: 'http',
host: 'localhost',
query_string: 'action=foobar&scope=all&state=opened')
end
before do
allow(helper).to receive(:request).and_return(request)
end
it_behaves_like 'masked url'
end
end
describe 'when url has no params to mask' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment