Commit 869d8e81 authored by Semyon Pupkov's avatar Semyon Pupkov

Fix UriDefaultParser cop

parent 2d0839e5
...@@ -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.
......
...@@ -3,7 +3,7 @@ module Gitlab ...@@ -3,7 +3,7 @@ module Gitlab
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
......
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