Don't use URI.regexp to validate since it doens't have start/end anchors.
This commit is contained in:
parent
cebb74a0c0
commit
9e52a2dcab
5 changed files with 5 additions and 5 deletions
|
@ -24,7 +24,7 @@ class ApplicationSetting < ActiveRecord::Base
|
|||
|
||||
validates :home_page_url,
|
||||
allow_blank: true,
|
||||
format: { with: URI::regexp(%w(http https)), message: "should be a valid url" },
|
||||
format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" },
|
||||
if: :home_page_url_column_exist
|
||||
|
||||
validates_each :restricted_visibility_levels do |record, attr, value|
|
||||
|
|
|
@ -28,7 +28,7 @@ class WebHook < ActiveRecord::Base
|
|||
default_timeout Gitlab.config.gitlab.webhook_timeout
|
||||
|
||||
validates :url, presence: true,
|
||||
format: { with: URI::regexp(%w(http https)), message: "should be a valid url" }
|
||||
format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" }
|
||||
|
||||
def execute(data)
|
||||
parsed_url = URI.parse(url)
|
||||
|
|
|
@ -25,7 +25,7 @@ class BambooService < CiService
|
|||
|
||||
validates :bamboo_url,
|
||||
presence: true,
|
||||
format: { with: URI::regexp },
|
||||
format: { with: /\A#{URI.regexp}\z/ },
|
||||
if: :activated?
|
||||
validates :build_key, presence: true, if: :activated?
|
||||
validates :username,
|
||||
|
|
|
@ -18,7 +18,7 @@ class ExternalWikiService < Service
|
|||
prop_accessor :external_wiki_url
|
||||
validates :external_wiki_url,
|
||||
presence: true,
|
||||
format: { with: URI::regexp },
|
||||
format: { with: /\A#{URI.regexp}\z/ },
|
||||
if: :activated?
|
||||
|
||||
def title
|
||||
|
|
|
@ -25,7 +25,7 @@ class TeamcityService < CiService
|
|||
|
||||
validates :teamcity_url,
|
||||
presence: true,
|
||||
format: { with: URI::regexp }, if: :activated?
|
||||
format: { with: /\A#{URI.regexp}\z/ }, if: :activated?
|
||||
validates :build_type, presence: true, if: :activated?
|
||||
validates :username,
|
||||
presence: true,
|
||||
|
|
Loading…
Reference in a new issue