1
0
Fork 0
forked from forgejo/forgejo

Merge branch 'master' of github.com:gogits/gogs

This commit is contained in:
skyblue 2014-03-25 18:35:15 +08:00
commit f0352789cd
22 changed files with 332 additions and 81 deletions

View file

@ -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
@ -243,7 +243,7 @@ func newNotifyMailService() {
}
func NewConfigContext() {
var err error
//var err error
workDir, err := exeDir()
if err != nil {
fmt.Printf("Fail to get work directory: %s\n", err)
@ -296,7 +296,7 @@ func NewConfigContext() {
func NewServices() {
newService()
NewLogService()
newLogService()
newCacheService()
newSessionService()
newMailService()

View file

@ -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 {