all repos — flounder @ fb381d94b811231496c78c6703cf46e4031e989f

A small site builder for the Gemini protocol

Fix proxy link regression
alex wennerberg alex@alexwennerberg.com
Thu, 07 Jan 2021 00:09:42 -0800
commit

fb381d94b811231496c78c6703cf46e4031e989f

parent

ce21fbbef51b224e3897cbcf2b4639a191c97e39

1 files changed, 12 insertions(+), 10 deletions(-)

jump to
M gmi2html.gogmi2html.go

@@ -32,16 +32,18 @@ u, err := url.Parse(urlstring)

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)