~adnano/go-gemini

b0f27c6f741b34cfcc8b8bdebd34d979eb79ebd3 — Adnan Maolood 6 months ago 8c0af18 master v0.2.3
fs: Prevent invalid directory links

A file with a name like "gemini:example" would previously result in the
following invalid link:

    => gemini:example gemini:example

Fix by prepending a "./" before each filename, so that the resulting
link looks like:

    => ./gemini:example gemini:example
1 files changed, 1 insertions(+), 1 deletions(-)

M fs.go
M fs.go => fs.go +1 -1
@@ 169,7 169,7 @@ func dirList(w ResponseWriter, f fs.File) {
		}
		link := LineLink{
			Name: name,
			URL:  (&url.URL{Path: name}).EscapedPath(),
			URL:  "./" + url.PathEscape(name),
		}
		fmt.Fprintln(w, link.String())
	}