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
e8820cc1
Commit
e8820cc1
authored
Mar 01, 2022
by
Niko Belokolodov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove double slashes from urls generated by PseudonymizationHelper
parent
32293539
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
app/helpers/routing/pseudonymization_helper.rb
app/helpers/routing/pseudonymization_helper.rb
+1
-5
spec/helpers/routing/pseudonymization_helper_spec.rb
spec/helpers/routing/pseudonymization_helper_spec.rb
+18
-8
No files found.
app/helpers/routing/pseudonymization_helper.rb
View file @
e8820cc1
...
...
@@ -15,7 +15,7 @@ module Routing
end
def
mask_params
return
default_root_url
+
@request
.
original_fullpath
unless
has_maskable_params?
return
@request
.
original_url
unless
has_maskable_params?
masked_params
=
@request
.
path_parameters
.
to_h
do
|
key
,
value
|
case
key
...
...
@@ -66,10 +66,6 @@ module Routing
query_string_hash
end
def
default_root_url
Gitlab
::
Routing
.
url_helpers
.
root_url
(
only_path:
false
)
end
end
def
masked_page_url
(
group
:,
project
:)
...
...
spec/helpers/routing/pseudonymization_helper_spec.rb
View file @
e8820cc1
...
...
@@ -222,16 +222,26 @@ RSpec.describe ::Routing::PseudonymizationHelper do
end
describe
'when url has no params to mask'
do
let
(
:root_url
)
{
'http://localhost/some/path'
}
let
(
:original_url
)
{
'http://localhost/-/security/vulnerabilities'
}
let
(
:request
)
do
double
(
:Request
,
path_parameters:
{
controller:
'security/vulnerabilities'
,
action:
'index'
},
protocol:
'http'
,
host:
'localhost'
,
query_string:
''
,
original_fullpath:
'/-/security/vulnerabilities'
,
original_url:
original_url
)
end
context
'returns root url'
do
before
do
controller
.
request
.
path
=
'some/path'
end
before
do
allow
(
helper
).
to
receive
(
:request
).
and_return
(
request
)
end
it
'masked_page_url'
do
expect
(
subject
).
to
eq
(
root_url
)
end
it
'returns unchanged url'
do
expect
(
subject
).
to
eq
(
original_url
)
end
end
...
...
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