summaryrefslogtreecommitdiff
path: root/app/validators
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-06-23 17:18:02 +0200
committerJames Lopez <james@jameslopez.es>2016-06-23 17:18:02 +0200
commit58c49966fa73469e324c51e26d8bc9a482627818 (patch)
treeda6770f6f8716dff80699f41addfd16a92e193b9 /app/validators
parent1e1bf322896fc515157b943a35e41632e26cda07 (diff)
downloadgitlab-ce-58c49966fa73469e324c51e26d8bc9a482627818.tar.gz
updated validator based on feedback
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/addressable_url_validator.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/validators/addressable_url_validator.rb b/app/validators/addressable_url_validator.rb
index 64e8581e0d3..cbb80b5c68e 100644
--- a/app/validators/addressable_url_validator.rb
+++ b/app/validators/addressable_url_validator.rb
@@ -29,9 +29,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator
value.strip!
- valid_uri?(value) && valid_protocol?(value)
- rescue Addressable::URI::InvalidURIError
- false
+ valid_protocol?(value) && valid_uri?(value)
end
def default_options
@@ -40,6 +38,8 @@ class AddressableUrlValidator < ActiveModel::EachValidator
def valid_uri?(value)
Addressable::URI.parse(value).is_a?(Addressable::URI)
+ rescue Addressable::URI::InvalidURIError
+ false
end
def valid_protocol?(value)