summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gopher.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/gopher.go b/gopher.go
index 196c1d0..3ad5ed2 100644
--- a/gopher.go
+++ b/gopher.go
@@ -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))
})
}