diff --git a/scripts/pi-hole/php/groups.php b/scripts/pi-hole/php/groups.php index 6ae6ccfb..72bd95ff 100644 --- a/scripts/pi-hole/php/groups.php +++ b/scripts/pi-hole/php/groups.php @@ -920,7 +920,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('Invalid adlist URL ' . htmlentities($address) . '
'. 'Added ' . $added . " out of ". $total . " adlists"); }