OSDN Git Service
(root)
/
wvm
/
gitlab.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
be6e52c
)
Use URI::regexp for validating WebHook urls
author
Ariejan de Vroom
<ariejan@ariejan.net>
Mon, 26 Dec 2011 09:12:09 +0000
(10:12 +0100)
committer
Ariejan de Vroom
<ariejan@ariejan.net>
Mon, 26 Dec 2011 09:12:09 +0000
(10:12 +0100)
app/models/web_hook.rb
patch
|
blob
|
history
diff --git
a/app/models/web_hook.rb
b/app/models/web_hook.rb
index
96684d1
..
0058bd5
100644
(file)
--- a/
app/models/web_hook.rb
+++ b/
app/models/web_hook.rb
@@
-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)