Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2018-06-11 16:29:37 +0300
committerDouwe Maan <douwe@gitlab.com>2018-06-11 16:29:37 +0300
commit1418afc2d6e7699f08a1fc5f33b78ea847ac1451 (patch)
tree7f1cd2621237c4dd234651bd16d6e304989b731d /lib/gitlab/url_blocker.rb
parent180dc237152d60d05e4f75d8c936e81ba783b6cd (diff)
Avoid checking the user format in every url validation
Diffstat (limited to 'lib/gitlab/url_blocker.rb')
-rw-r--r--lib/gitlab/url_blocker.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/url_blocker.rb b/lib/gitlab/url_blocker.rb
index 20be193ea0c..38be75b7482 100644
--- a/lib/gitlab/url_blocker.rb
+++ b/lib/gitlab/url_blocker.rb
@@ -5,7 +5,7 @@ module Gitlab
BlockedUrlError = Class.new(StandardError)
class << self
- def validate!(url, allow_localhost: false, allow_local_network: true, ports: [], protocols: [])
+ def validate!(url, allow_localhost: false, allow_local_network: true, enforce_user: false, ports: [], protocols: [])
return true if url.nil?
begin
@@ -20,7 +20,7 @@ module Gitlab
port = uri.port || uri.default_port
validate_protocol!(uri.scheme, protocols)
validate_port!(port, ports) if ports.any?
- validate_user!(uri.user)
+ validate_user!(uri.user) if enforce_user
validate_hostname!(uri.hostname)
begin