From: Sergey Matveev Date: Thu, 10 Aug 2023 14:13:01 +0000 (+0300) Subject: gemini's links can be without whitespace after => X-Git-Tag: v0.2.0~3 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;ds=sidebyside;h=e3f55829f3b5a162b3aa9a0af688bf33ad9682c6;p=tofuproxy.git gemini's links can be without whitespace after => --- diff --git a/rounds/gemini.go b/rounds/gemini.go index d81039f..219fdcb 100644 --- a/rounds/gemini.go +++ b/rounds/gemini.go @@ -221,19 +221,20 @@ func RoundGemini( fmt.Fprintf(&buf, "%s\n", line) continue } - if strings.HasPrefix(line, "=> ") { + if strings.HasPrefix(line, "=>") { + line = strings.TrimLeft(line[2:], " ") cols = strings.Fields(line) - u := geminifyURL(host, cols[1], paths...) + u := geminifyURL(host, cols[0], paths...) switch len(cols) { - case 2: + case 1: fmt.Fprintf( &buf, "%s
\n", - u, html.EscapeString(cols[1]), + u, html.EscapeString(cols[0]), ) default: fmt.Fprintf( &buf, "%s (%s)
\n", - u, html.EscapeString(strings.Join(cols[2:], " ")), cols[1], + u, html.EscapeString(strings.Join(cols[1:], " ")), cols[0], ) } continue