Added protection against unsupported URLs
This commit is contained in:
parent
26fcfa1bd9
commit
42d814656a
1 changed files with 12 additions and 0 deletions
|
@ -57,6 +57,18 @@ function bindUrlHandlerEvents()
|
||||||
url = url.replace(/^\s+|\s+$/, '');
|
url = url.replace(/^\s+|\s+$/, '');
|
||||||
if (url == '')
|
if (url == '')
|
||||||
return;
|
return;
|
||||||
|
protocol = /^(\w+):\/\//.exec(url)
|
||||||
|
if (!protocol)
|
||||||
|
url = 'http://' + url;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
protocol = protocol[1].toLowerCase();
|
||||||
|
if (protocol != 'http' && protocol != 'https')
|
||||||
|
{
|
||||||
|
alert('Unsupported protocol: ' + protocol);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
$('#url-handler-wrapper input').val('');
|
$('#url-handler-wrapper input').val('');
|
||||||
addURLs([url]);
|
addURLs([url]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue