Commit 5ca83604 authored by Ariejan de Vroom's avatar Ariejan de Vroom

Use URI::regexp for validating WebHook urls

parent be6e52c2
...@@ -9,7 +9,7 @@ class WebHook < ActiveRecord::Base ...@@ -9,7 +9,7 @@ class WebHook < ActiveRecord::Base
validates :url, validates :url,
presence: true, presence: true,
format: { 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" } message: "should be a valid url" }
def execute(data) def execute(data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment