diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-09-23 13:17:17 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-09-23 13:17:17 -0600 |
commit | 3a7077d0f92998e932cd249e1ea85fad35e85ba2 (patch) | |
tree | 50c79bf0c9a88302bd92dcb0ef2ab947270741d2 /gopher.go | |
parent | 32f84de36c9da1da47b718cb942afa36d1b23922 (diff) |
use gopher.GuessItemType on blobs
Diffstat (limited to 'gopher.go')
-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)) }) } |