aboutsummaryrefslogtreecommitdiff
path: root/modules/base
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-25 00:02:37 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-25 00:02:37 +0800
commit8909935a1049dea3783021f0460118ad838b1dfd (patch)
tree00d23ec41174cda54d5bf2de1175a9d635b75f9a /modules/base
parent62b05c1e228f1a570a97e6957c45e018262f812f (diff)
parent6302f5462890b455cb306fc3925c71850a6e1dfb (diff)
Merge branch 'master' of https://github.com/gogits/gogs
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/conf.go4
-rw-r--r--modules/base/markdown.go9
2 files changed, 11 insertions, 2 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index b4e0de97..d3122a53 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -100,7 +100,7 @@ func newService() {
Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR", false)
}
-func NewLogService() {
+func newLogService() {
// Get and check log mode.
LogMode = Cfg.MustValue("log", "MODE", "console")
modeSec := "log." + LogMode
@@ -296,7 +296,7 @@ func NewConfigContext() {
func NewServices() {
newService()
- NewLogService()
+ newLogService()
newCacheService()
newSessionService()
newMailService()
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 {