Simplified gophertype fix for search response

This commit is contained in:
sloumdrone 2019-08-30 19:50:52 -07:00
parent 2e964cc586
commit bfa8a162e3
2 changed files with 6 additions and 4 deletions

View File

@ -95,10 +95,7 @@ func Visit(addr, openhttp string) (View, error) {
return View{}, fmt.Errorf("")
}
} else if u.Gophertype == "7" && strings.Contains(u.Resource, "\t") {
u.Gophertype = "1"
u.Full = u.Scheme + "://" + u.Host + ":" + u.Port + "/" + u.Gophertype + u.Resource
}
}
text, err := Retrieve(u)
if err != nil {

View File

@ -3,6 +3,7 @@ package gopher
import (
"errors"
"regexp"
"strings"
)
//------------------------------------------------\\
@ -76,6 +77,10 @@ func MakeUrl(u string) (Url, error) {
out.Gophertype = "0"
}
if out.Gophertype == "7" && strings.Contains(out.Resource, "\t") {
out.Gophertype = "1"
}
switch out.Gophertype {
case "1", "0", "h", "7":
out.IsBinary = false