Merge pull request 'Adds in the correct variable when checking for existing querystring value' (#166) from fix-repeated-query into release-2.3.1

Since this has been reviewed as functional I am merging into the release branch. There will be another opportunity to review, if need be, for the release branch when a PR is made into `develop`.
This commit is contained in:
Sloom Sloum Sluom IV 2020-05-28 00:49:28 -04:00
commit 38144a0e2a
1 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"path/filepath"
"regexp"
@ -700,20 +701,20 @@ 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
}
// 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: