all repos — flounder @ 556101d329d23e1a8bbe463f6eadfda571231f49

A small site builder for the Gemini protocol

think i fixed url translation
alex wennerberg alex@alexwennerberg.com
Thu, 07 Jan 2021 00:15:17 -0800
commit

556101d329d23e1a8bbe463f6eadfda571231f49

parent

fb381d94b811231496c78c6703cf46e4031e989f

1 files changed, 11 insertions(+), 11 deletions(-)

jump to
M gmi2html.gogmi2html.go

@@ -33,17 +33,17 @@ if err != nil {

continue } 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()) - } + u = reqUrl.ResolveReference(u) + } + if u.Scheme == "gemini" || (reqUrl != nil && 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)