aboutsummaryrefslogtreecommitdiff
path: root/modules/base/markdown.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-24 11:58:58 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-24 11:58:58 -0400
commitd2ceb001d0373b0ab3aab76a53497afb6b56650a (patch)
treec6ab391c1fbe64072b6b977a5fcf4f5dc1117484 /modules/base/markdown.go
parent6337d3bf193491aeb9f6a03b260e7c7089c59f76 (diff)
parentff362484191d08db2e2bda238934b780139b9048 (diff)
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'modules/base/markdown.go')
-rw-r--r--modules/base/markdown.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index 05ce0c83..c722f04b 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -6,6 +6,7 @@ package base
import (
"bytes"
+ "net/http"
"path"
"path/filepath"
"strings"
@@ -42,6 +43,14 @@ func IsMarkdownFile(name string) bool {
return false
}
+func IsTextFile(data []byte) (string, bool) {
+ contentType := http.DetectContentType(data)
+ if strings.Index(contentType, "text/") != -1 {
+ return contentType, true
+ }
+ return contentType, false
+}
+
func IsReadmeFile(name string) bool {
name = strings.ToLower(name)
if len(name) < 6 {