From 40f55d894baaa47fc154dcb96286b3ec888f9599 Mon Sep 17 00:00:00 2001 From: William Rehwinkel <49931356+FiskFan1999@users.noreply.github.com> Date: Fri, 19 May 2023 20:44:23 -0400 Subject: [PATCH] localhost is direct URL now instead of geminispace.info/search?localhost (#326) (#327) --- display/display.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/display/display.go b/display/display.go index 15a0fb8..8da59e1 100644 --- a/display/display.go +++ b/display/display.go @@ -215,9 +215,10 @@ func Init(version, commit, builtBy string) { // We don't want to convert legitimate // :// links to search terms. query := strings.TrimSpace(query) - if (strings.Contains(query, " ") && !hasSpaceisURL.MatchString(query)) || + if ((strings.Contains(query, " ") && !hasSpaceisURL.MatchString(query)) || (!strings.HasPrefix(query, "//") && !strings.Contains(query, "://") && - !strings.Contains(query, ".")) && !strings.HasPrefix(query, "about:") { + !strings.Contains(query, ".")) && !strings.HasPrefix(query, "about:")) && + !(query == "localhost" || strings.HasPrefix(query, "localhost/") || strings.HasPrefix(query, "localhost:")) { // Has a space and follows regex, OR // doesn't start with "//", contain "://", and doesn't have a dot either. // Then it's a search