From f47f6597f4931ad178516a1af96c45f3f6abacab Mon Sep 17 00:00:00 2001 From: sloum Date: Mon, 25 May 2020 19:12:52 -0700 Subject: [PATCH 1/2] Adds in the correct variable when checking for existing querystring value --- client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 80210e6..c2b181d 100644 --- a/client.go +++ b/client.go @@ -700,14 +700,14 @@ func (c *client) search(query, uri, question string) { var rootUrl string switch u.Scheme { case "gopher": - if ind := strings.Index(entry, "\t"); ind >= 0 { + if ind := strings.Index(u.Full, "\t"); ind >= 0 { rootUrl = u.Full[:ind] } else { rootUrl = u.Full } c.Visit(fmt.Sprintf("%s\t%s", rootUrl, entry)) case "gemini": - if ind := strings.Index(entry, "?"); ind >= 0 { + if ind := strings.Index(u.Full, "?"); ind >= 0 { rootUrl = u.Full[:ind] } else { rootUrl = u.Full From 022752348747291ae9bc1d15010c6810764482bd Mon Sep 17 00:00:00 2001 From: sloum Date: Mon, 25 May 2020 19:43:19 -0700 Subject: [PATCH 2/2] Adds query escaping --- client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index c2b181d..4617b2d 100644 --- a/client.go +++ b/client.go @@ -3,6 +3,7 @@ package main import ( "fmt" "io/ioutil" + "net/url" "os" "path/filepath" "regexp" @@ -712,8 +713,8 @@ func (c *client) search(query, uri, question string) { } else { rootUrl = u.Full } - // escapedEntry := url.QueryEscape(entry) // TODO confirm expected behavior re: escaping - c.Visit(fmt.Sprintf("%s?%s", rootUrl, entry)) + escapedEntry := url.PathEscape(entry) + c.Visit(fmt.Sprintf("%s?%s", rootUrl, escapedEntry)) case "http", "https": c.Visit(u.Full) default: