Merge pull request #1683 from mdujava/basic_auth

Url of adlist can contain userinfo (basicauth)
This commit is contained in:
Adam Warner
2021-01-13 20:41:50 +00:00
committed by GitHub

View File

@@ -937,7 +937,11 @@ if ($_POST['action'] == 'get_groups') {
continue;
}
if(preg_match("/[^a-zA-Z0-9:\/?&%=~._()-;]/", $address) !== 0) {
// this will remove first @ that is after schema and before domain
// $1 is optional schema, $2 is userinfo
$check_address = preg_replace("|([^:/]*://)?([^/]+)@|", "$1$2", $address, 1);
if(preg_match("/[^a-zA-Z0-9:\/?&%=~._()-;]/", $check_address) !== 0) {
throw new Exception('<strong>Invalid adlist URL ' . htmlentities($address) . '</strong><br>'.
'Added ' . $added . " out of ". $total . " adlists");
}