Release 2.3.1 -> Develop #171

Merged
sloum merged 14 commits from release-2.3.1 into develop 2020-05-30 16:51:05 +00:00
Showing only changes of commit 38144a0e2a - Show all commits

View File

@ -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: