mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Added protection against unsupported URLs
This commit is contained in:
@ -57,6 +57,18 @@ function bindUrlHandlerEvents()
|
||||
url = url.replace(/^\s+|\s+$/, '');
|
||||
if (url == '')
|
||||
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('');
|
||||
addURLs([url]);
|
||||
});
|
||||
|
Reference in New Issue
Block a user