flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit fb381d94b811231496c78c6703cf46e4031e989f
parent ce21fbbef51b224e3897cbcf2b4639a191c97e39
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu,  7 Jan 2021 00:09:42 -0800

Fix proxy link regression

Diffstat:
Mgmi2html.go | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/gmi2html.go b/gmi2html.go @@ -32,16 +32,18 @@ func textToHTML(reqUrl *url.URL, text gemini.Text) string { if err != nil { continue } - u = reqUrl.ResolveReference(u) - if u.Scheme == "gemini" || u.Scheme == "" { - 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()) + if reqUrl != nil { + // proxy + if u.Scheme == "gemini" || u.Scheme == "" { + 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)