Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
869d8e81
Commit
869d8e81
authored
Sep 21, 2018
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UriDefaultParser cop
parent
2d0839e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
6 deletions
+1
-6
.rubocop_todo.yml
.rubocop_todo.yml
+0
-5
lib/gitlab/url_sanitizer.rb
lib/gitlab/url_sanitizer.rb
+1
-1
No files found.
.rubocop_todo.yml
View file @
869d8e81
...
@@ -130,11 +130,6 @@ Naming/HeredocDelimiterCase:
...
@@ -130,11 +130,6 @@ Naming/HeredocDelimiterCase:
Naming/HeredocDelimiterNaming
:
Naming/HeredocDelimiterNaming
:
Enabled
:
false
Enabled
:
false
# Offense count: 1
# Cop supports --auto-correct.
Performance/UriDefaultParser
:
Exclude
:
-
'
lib/gitlab/url_sanitizer.rb'
# Offense count: 3821
# Offense count: 3821
# Configuration parameters: Prefixes.
# Configuration parameters: Prefixes.
...
...
lib/gitlab/url_sanitizer.rb
View file @
869d8e81
...
@@ -3,7 +3,7 @@ class UrlSanitizer
...
@@ -3,7 +3,7 @@ class UrlSanitizer
ALLOWED_SCHEMES
=
%w[http https ssh git]
.
freeze
ALLOWED_SCHEMES
=
%w[http https ssh git]
.
freeze
def
self
.
sanitize
(
content
)
def
self
.
sanitize
(
content
)
regexp
=
URI
::
Parser
.
new
.
make_regexp
(
ALLOWED_SCHEMES
)
regexp
=
URI
::
DEFAULT_PARSER
.
make_regexp
(
ALLOWED_SCHEMES
)
content
.
gsub
(
regexp
)
{
|
url
|
new
(
url
).
masked_url
}
content
.
gsub
(
regexp
)
{
|
url
|
new
(
url
).
masked_url
}
rescue
Addressable
::
URI
::
InvalidURIError
rescue
Addressable
::
URI
::
InvalidURIError
...
...
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