diff options
-rw-r--r-- | gopher.go | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -135,16 +135,9 @@ func gopherTreePath(tmpl *template.Template, haspath bool) sliderule.Handler { } filetype := gopher.MenuType - ext := path.Ext(params["path"]) - if ext != ".gph" && params["path"] != "gophermap" { - mtype := mime.TypeByExtension(ext) - if strings.HasPrefix(mtype, "text/") { - filetype = gopher.TextFileType - } else { - filetype = gopher.BinaryFileType - } + if path.Base(params["path"]) != "gophermap" { + filetype = gopher.GuessItemType(params["path"]) } - return gopher.File(filetype, bytes.NewBuffer(body)) }) } |