fix: Add final . for domain lookup

This commit is contained in:
overflowerror 2023-12-03 13:59:51 +01:00
parent 541100e6ac
commit 099c85ef7b

View file

@ -36,6 +36,11 @@ function validateInput(string $url) {
$matches $matches
); );
$hostname = $matches[1] ?? null; $hostname = $matches[1] ?? null;
if ($hostname[strlen($hostname) - 1] != ".") {
// add . so DNS lookup won't fail
$hostname .= ".";
}
$matches = []; $matches = [];
preg_match( preg_match(
"/^.*?:\/\/([0-9:.]+).*$/", "/^.*?:\/\/([0-9:.]+).*$/",