diff options
| -rw-r--r-- | lib/utils.coffee | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index 6a846ae0..91d79c4c 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -32,9 +32,10 @@ Utils =    # Completes a partial URL (without scheme)    createFullUrl: (partialUrl) -> -    if (!/^[a-z]{3,}:\/\//.test(partialUrl)) -      partialUrl = "http://" + partialUrl -    partialUrl +    if (!/^[a-z]{3,}:\/\//.test(partialUrl)) and not /^view-source:/.test partialUrl +      "http://" + partialUrl +    else +      partialUrl    # Tries to detect, whether :str is a valid URL.    isUrl: (str) -> @@ -53,6 +54,10 @@ Utils =      # are there more?      specialHostNames = [ 'localhost' ] +    # special-case view-source:[url] +    if /^view-source:/.test str +      return true +      # it starts with a scheme, so it's definitely an URL      if (/^[a-z]{3,}:\/\//.test(str))        return true | 
