flounder

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

commit ae1e33aa0df0fd919af8cf9ea1cebcd708900c9e
parent d8647e6a087a23309305a5a0c7075c7e7ddf9ed4
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed,  6 Jan 2021 23:40:45 -0800

fix scheme links for local flounder

Diffstat:
Mgmi2html.go | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/gmi2html.go b/gmi2html.go @@ -33,10 +33,15 @@ func textToHTML(text gemini.Text) string { 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 == "" {