forked from forgejo/forgejo
Merge branch 'master' of github.com:gogits/gogs
This commit is contained in:
commit
f0352789cd
22 changed files with 332 additions and 81 deletions
|
@ -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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue