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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
759f34bd
Commit
759f34bd
authored
Sep 06, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport EE fixes to Gitlab::UrlSanitizer to CE
parent
5dd06f69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
lib/gitlab/url_sanitizer.rb
lib/gitlab/url_sanitizer.rb
+6
-6
spec/lib/gitlab/url_sanitizer_spec.rb
spec/lib/gitlab/url_sanitizer_spec.rb
+1
-0
No files found.
lib/gitlab/url_sanitizer.rb
View file @
759f34bd
...
...
@@ -9,7 +9,7 @@ module Gitlab
end
def
self
.
valid?
(
url
)
return
false
unless
url
return
false
unless
url
.
present?
Addressable
::
URI
.
parse
(
url
.
strip
)
...
...
@@ -29,13 +29,13 @@ module Gitlab
def
masked_url
url
=
@url
.
dup
url
.
password
=
"*****"
unless
url
.
password
.
nil
?
url
.
user
=
"*****"
unless
url
.
user
.
nil
?
url
.
password
=
"*****"
if
url
.
password
.
present
?
url
.
user
=
"*****"
if
url
.
user
.
present
?
url
.
to_s
end
def
credentials
@credentials
||=
{
user:
@url
.
user
,
password:
@url
.
password
}
@credentials
||=
{
user:
@url
.
user
.
presence
,
password:
@url
.
password
.
presence
}
end
def
full_url
...
...
@@ -47,8 +47,8 @@ module Gitlab
def
generate_full_url
return
@url
unless
valid_credentials?
@full_url
=
@url
.
dup
@full_url
.
user
=
credentials
[
:user
]
@full_url
.
password
=
credentials
[
:password
]
@full_url
.
user
=
credentials
[
:user
]
.
presence
@full_url
.
password
=
credentials
[
:password
]
.
presence
@full_url
end
...
...
spec/lib/gitlab/url_sanitizer_spec.rb
View file @
759f34bd
...
...
@@ -57,6 +57,7 @@ describe Gitlab::UrlSanitizer do
describe
'.valid?'
do
it
'validates url strings'
do
expect
(
described_class
.
valid?
(
nil
)).
to
be
(
false
)
expect
(
described_class
.
valid?
(
''
)).
to
be
(
false
)
expect
(
described_class
.
valid?
(
'valid@project:url.git'
)).
to
be
(
true
)
expect
(
described_class
.
valid?
(
'123://invalid:url'
)).
to
be
(
false
)
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