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:
commit
38144a0e2a
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
@ -700,20 +701,20 @@ func (c *client) search(query, uri, question string) {
|
||||||
var rootUrl string
|
var rootUrl string
|
||||||
switch u.Scheme {
|
switch u.Scheme {
|
||||||
case "gopher":
|
case "gopher":
|
||||||
if ind := strings.Index(entry, "\t"); ind >= 0 {
|
if ind := strings.Index(u.Full, "\t"); ind >= 0 {
|
||||||
rootUrl = u.Full[:ind]
|
rootUrl = u.Full[:ind]
|
||||||
} else {
|
} else {
|
||||||
rootUrl = u.Full
|
rootUrl = u.Full
|
||||||
}
|
}
|
||||||
c.Visit(fmt.Sprintf("%s\t%s", rootUrl, entry))
|
c.Visit(fmt.Sprintf("%s\t%s", rootUrl, entry))
|
||||||
case "gemini":
|
case "gemini":
|
||||||
if ind := strings.Index(entry, "?"); ind >= 0 {
|
if ind := strings.Index(u.Full, "?"); ind >= 0 {
|
||||||
rootUrl = u.Full[:ind]
|
rootUrl = u.Full[:ind]
|
||||||
} else {
|
} else {
|
||||||
rootUrl = u.Full
|
rootUrl = u.Full
|
||||||
}
|
}
|
||||||
// escapedEntry := url.QueryEscape(entry) // TODO confirm expected behavior re: escaping
|
escapedEntry := url.PathEscape(entry)
|
||||||
c.Visit(fmt.Sprintf("%s?%s", rootUrl, entry))
|
c.Visit(fmt.Sprintf("%s?%s", rootUrl, escapedEntry))
|
||||||
case "http", "https":
|
case "http", "https":
|
||||||
c.Visit(u.Full)
|
c.Visit(u.Full)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue