Use URI::regexp for validating WebHook urls

This commit is contained in:
Ariejan de Vroom 2011-12-26 10:12:09 +01:00
parent be6e52c2f6
commit 5ca836048d

View file

@ -9,7 +9,7 @@ class WebHook < ActiveRecord::Base
validates :url,
presence: true,
format: {
with: /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix,
with: URI::regexp(%w(http https)),
message: "should be a valid url" }
def execute(data)