Permalink
Browse files

check for scheme in url

  • Loading branch information...
1 parent 03b67e9 commit d9df5f2794d837321d2709d14117bd2c0c80ee25 @yetzt committed Apr 2, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 app.js
View
4 app.js
@@ -51,7 +51,7 @@ app.post('/api/create', function(req, res){
return this;
});
- req.assert('url', __("This URL is invalid")).isUrl();
+ req.assert('url', __("This URL is invalid")).isUrl().regex(/^(http(s)?:\/\/)/);
var url = encodeURI(decodeURI(req.body.url));
if (errors.length > 0) {
@@ -78,7 +78,7 @@ app.post('/create', function(req, res){
return this;
});
- req.assert('url', __("This URL is invalid")).notEmpty().isUrl();
+ req.assert('url', __("This URL is invalid")).notEmpty().isUrl().regex(/^(http(s)?:\/\/)/);
var url = encodeURI(decodeURI(req.body.url));

0 comments on commit d9df5f2

Please sign in to comment.