1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-11-23 16:52:06 +01:00

fs: Trim trailing slash from name in ServeFile

This commit is contained in:
adnano 2021-02-17 01:36:53 -05:00
parent bf95ca8ed8
commit a14c0c1825

2
fs.go

@ -46,7 +46,7 @@ func ServeFile(w ResponseWriter, fsys fs.FS, name string) {
if name == "/" {
name = "."
} else {
name = strings.TrimPrefix(name, "/")
name = strings.Trim(name, "/")
}
f, err := fsys.Open(name)