summaryrefslogtreecommitdiff
path: root/gopher.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-23 13:17:17 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-23 13:17:17 -0600
commit3a7077d0f92998e932cd249e1ea85fad35e85ba2 (patch)
tree50c79bf0c9a88302bd92dcb0ef2ab947270741d2 /gopher.go
parent32f84de36c9da1da47b718cb942afa36d1b23922 (diff)
use gopher.GuessItemType on blobs
Diffstat (limited to 'gopher.go')
-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))
})
}