summaryrefslogtreecommitdiff
path: root/src/edit/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit/util.go')
-rw-r--r--src/edit/util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/edit/util.go b/src/edit/util.go
index 566796c..b6dfde1 100644
--- a/src/edit/util.go
+++ b/src/edit/util.go
@@ -1,7 +1,10 @@
package main
import (
+ "mime"
+ "net/http"
"os/exec"
+ "path"
)
type exitError exec.ExitError
@@ -23,3 +26,11 @@ func errcheck(err error) {
panic(err)
}
}
+
+func getctype(name string, content []byte) string {
+ ctype := mime.TypeByExtension(path.Ext(name))
+ if ctype == "" {
+ ctype = http.DetectContentType(content)
+ }
+ return ctype
+}