summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-03-24 23:56:32 +0800
committerslene <vslene@gmail.com>2014-03-24 23:56:32 +0800
commitff362484191d08db2e2bda238934b780139b9048 (patch)
tree691a564e36ed971c7eb1f28b8c69fb74a7f9ffe4 /modules
parent92a6058e29eb5f9cd655c3b1f8f43fd6d46fe5a4 (diff)
downloadgitea-ff362484191d08db2e2bda238934b780139b9048.tar.gz
gitea-ff362484191d08db2e2bda238934b780139b9048.zip
raw download
Diffstat (limited to 'modules')
-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 05ce0c833c..c722f04b2e 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 {