From 099c85ef7bcfd7625dd9eed64544e6e72a611fd8 Mon Sep 17 00:00:00 2001 From: overflowerror Date: Sun, 3 Dec 2023 13:59:51 +0100 Subject: [PATCH] fix: Add final . for domain lookup --- controllers/manage/POST.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/manage/POST.php b/controllers/manage/POST.php index 3244b07..f5a15e3 100644 --- a/controllers/manage/POST.php +++ b/controllers/manage/POST.php @@ -36,6 +36,11 @@ function validateInput(string $url) { $matches ); $hostname = $matches[1] ?? null; + if ($hostname[strlen($hostname) - 1] != ".") { + // add . so DNS lookup won't fail + $hostname .= "."; + } + $matches = []; preg_match( "/^.*?:\/\/([0-9:.]+).*$/",