flounder

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

commit 556101d329d23e1a8bbe463f6eadfda571231f49
parent fb381d94b811231496c78c6703cf46e4031e989f
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu,  7 Jan 2021 00:15:17 -0800

think i fixed url translation

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

diff --git a/gmi2html.go b/gmi2html.go @@ -33,17 +33,17 @@ func textToHTML(reqUrl *url.URL, text gemini.Text) string { 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)