aboutsummaryrefslogtreecommitdiff
path: root/modules/base/markdown.go
diff options
context:
space:
mode:
authorskyblue <ssx205@gmail.com>2014-03-25 18:35:15 +0800
committerskyblue <ssx205@gmail.com>2014-03-25 18:35:15 +0800
commitf0352789cd1e5c3ee35ed685e29421f0bc02f336 (patch)
treee3c0454dcba62f689221d5a97efcef342c06ffd2 /modules/base/markdown.go
parent7048ea45279cd96f88845d83fe7cef6fbb545fcf (diff)
parent4e88ae19d1e2e91e4d3168304c06fcbce73c31bf (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 {