summaryrefslogtreecommitdiff
path: root/app/validators
diff options
context:
space:
mode:
authorevuez <helloevuez@gmail.com>2016-02-22 13:55:36 +0100
committerRobert Speicher <rspeicher@gmail.com>2016-02-26 14:34:06 -0500
commit4d0e2979b9a17160ad93ff704e7a51f78b4f3b4c (patch)
tree1043f0701028e1abc9155821ae442da16a99a763 /app/validators
parent01160fc06182de89c400af174861f6545ad6ceb8 (diff)
downloadgitlab-ce-4d0e2979b9a17160ad93ff704e7a51f78b4f3b4c.tar.gz
Allow webhooks URL to have leading and trailing spacesevuez/gitlab-ce-webhook-url-spaces
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/url_validator.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/validators/url_validator.rb b/app/validators/url_validator.rb
index 2848b9cd33d..a77beb2683d 100644
--- a/app/validators/url_validator.rb
+++ b/app/validators/url_validator.rb
@@ -29,8 +29,11 @@ class UrlValidator < ActiveModel::EachValidator
end
def valid_url?(value)
+ return false if value.nil?
+
options = default_options.merge(self.options)
+ value.strip!
value =~ /\A#{URI.regexp(options[:protocols])}\z/
end
end