diff options
author | James Lopez <james@jameslopez.es> | 2016-06-20 11:34:34 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-20 11:34:34 +0200 |
commit | a5abec905fc69a9999887ea11335f032b4dfa957 (patch) | |
tree | c8af698ee230c23b9a9dcf9bccc77eaf9a2a2587 /app/validators | |
parent | 6e7a4297d5e75064cf9713af556596a451e94f34 (diff) | |
download | gitlab-ce-a5abec905fc69a9999887ea11335f032b4dfa957.tar.gz |
fix addressable url validator
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/addressable_url_validator.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/validators/addressable_url_validator.rb b/app/validators/addressable_url_validator.rb index 4e1a01a1bff..7aab66548e2 100644 --- a/app/validators/addressable_url_validator.rb +++ b/app/validators/addressable_url_validator.rb @@ -1,18 +1,18 @@ -# UrlValidator +# AddressableUrlValidator # -# Custom validator for URLs. +# Custom validator for URLs. This is a # -# By default, only URLs for the HTTP(S) protocols will be considered valid. +# By default, only URLs for http, https, ssh, and git protocols will be considered valid. # Provide a `:protocols` option to configure accepted protocols. # # Example: # # class User < ActiveRecord::Base -# validates :personal_url, url: true +# validates :personal_url, addressable_url: true # -# validates :ftp_url, url: { protocols: %w(ftp) } +# validates :ftp_url, addressable_url: { protocols: %w(ftp) } # -# validates :git_url, url: { protocols: %w(http https ssh git) } +# validates :git_url, addressable_url: { protocols: %w(http https ssh git) } # end # class AddressableUrlValidator < ActiveModel::EachValidator @@ -39,7 +39,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator end def valid_uri?(value) - Addressable::URI.parse(strip).is_a?(Addressable::URI) + Addressable::URI.parse(value).is_a?(Addressable::URI) end def valid_protocol?(value) |