From bbea4b123fe9da0511b1698f07868c27299ae24f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 6 Nov 2014 09:01:22 +0000 Subject: Add (initial, basic) isUrl tests (more needed). --- lib/utils.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/utils.coffee b/lib/utils.coffee index 62749496..b7f8731a 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -43,12 +43,12 @@ Utils = # Tries to detect if :str is a valid URL. isUrl: (str) -> - # Starts with a scheme: URL - return true if @hasFullUrlPrefix str - # Must not contain spaces return false if ' ' in str + # Starts with a scheme: URL + return true if @hasFullUrlPrefix str + # More or less RFC compliant URL host part parsing. This should be sufficient for our needs urlRegex = new RegExp( '^(?:([^:]+)(?::([^:]+))?@)?' + # user:password (optional) => \1, \2 -- cgit v1.2.3