Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e9a20105
Commit
e9a20105
authored
Nov 08, 2021
by
Piotr Skorupa
Committed by
Mikołaj Wawrzyniak
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix overwriting path params by query params
parent
7db1a691
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
app/helpers/routing/pseudonymization_helper.rb
app/helpers/routing/pseudonymization_helper.rb
+2
-2
spec/helpers/routing/pseudonymization_helper_spec.rb
spec/helpers/routing/pseudonymization_helper_spec.rb
+20
-0
No files found.
app/helpers/routing/pseudonymization_helper.rb
View file @
e9a20105
...
...
@@ -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
...
...
spec/helpers/routing/pseudonymization_helper_spec.rb
View file @
e9a20105
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment