fix scheme links for local flounder
alex wennerberg alex@alexwennerberg.com
Wed, 06 Jan 2021 23:40:45 -0800
1 files changed,
9 insertions(+),
4 deletions(-)
jump to
M
gmi2html.go
→
gmi2html.go
@@ -33,10 +33,15 @@ if err != nil {
continue } if u.Scheme == "gemini" { - u.Path = fmt.Sprintf("/%s%s", u.Host, u.Path) - u.Scheme = "" - u.Host = "proxy." + c.Host - urlstring = html.EscapeString(u.String()) + if strings.HasSuffix(u.Host, c.Host) { + u.Scheme = "" + urlstring = html.EscapeString(u.String()) + } else { + u.Path = fmt.Sprintf("/%s%s", u.Host, u.Path) + u.Scheme = "" + u.Host = "proxy." + c.Host + urlstring = html.EscapeString(u.String()) + } } name := html.EscapeString(link.Name) if name == "" {