From 4d0e2979b9a17160ad93ff704e7a51f78b4f3b4c Mon Sep 17 00:00:00 2001 From: evuez Date: Mon, 22 Feb 2016 13:55:36 +0100 Subject: Allow webhooks URL to have leading and trailing spaces --- app/validators/url_validator.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') 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 -- cgit v1.2.3