From 82a999eb8789e8b794495f9203fac8c05be73afa Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 17 Nov 2025 18:07:36 -0500 Subject: [PATCH] Fix resolve --- util/util.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/util/util.go b/util/util.go index 98f9828..ebb13da 100644 --- a/util/util.go +++ b/util/util.go @@ -14,6 +14,16 @@ import ( ) func ResolveDomain(domain string) (string, error) { + // trim whitespace + domain = strings.TrimSpace(domain) + + // Remove any protocol prefix if present (do this first, before splitting host/port) + domain = strings.TrimPrefix(domain, "http://") + domain = strings.TrimPrefix(domain, "https://") + + // if there are any trailing slashes, remove them + domain = strings.TrimSuffix(domain, "/") + // Check if there's a port in the domain host, port, err := net.SplitHostPort(domain) if err != nil { @@ -22,16 +32,6 @@ func ResolveDomain(domain string) (string, error) { port = "" } - // Remove any protocol prefix if present - if strings.HasPrefix(host, "http://") { - host = strings.TrimPrefix(host, "http://") - } else if strings.HasPrefix(host, "https://") { - host = strings.TrimPrefix(host, "https://") - } - - // if there are any trailing slashes, remove them - host = strings.TrimSuffix(host, "/") - // Lookup IP addresses ips, err := net.LookupIP(host) if err != nil {