aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/serve.go2
-rw-r--r--cmd/web.go20
2 files changed, 16 insertions, 6 deletions
diff --git a/cmd/serve.go b/cmd/serve.go
index 1138317e..484060c4 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -128,7 +128,7 @@ func runServ(c *cli.Context) {
repo, err := models.GetRepositoryByName(repoUser.Id, repoName)
if err != nil {
- if err == models.ErrRepoNotExist {
+ if models.IsErrRepoNotExist(err) {
if user.Id == repoUser.Id || repoUser.IsOwnedBy(user.Id) {
fail("Repository does not exist", "Repository does not exist: %s/%s", repoUser.Name, repoName)
} else {
diff --git a/cmd/web.go b/cmd/web.go
index 8213baab..f02a9831 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -34,6 +34,7 @@ import (
"github.com/gogits/gogs/modules/auth/apiv1"
"github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/bindata"
"github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware"
@@ -78,11 +79,11 @@ func checkVersion() {
// Check dependency version.
checkers := []VerChecker{
- {"github.com/Unknwon/macaron", macaron.Version, "0.5.1"},
- {"github.com/macaron-contrib/binding", binding.Version, "0.0.5"},
+ {"github.com/Unknwon/macaron", macaron.Version, "0.5.4"},
+ {"github.com/macaron-contrib/binding", binding.Version, "0.0.6"},
{"github.com/macaron-contrib/cache", cache.Version, "0.0.7"},
{"github.com/macaron-contrib/csrf", csrf.Version, "0.0.3"},
- {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.5"},
+ {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.7"},
{"github.com/macaron-contrib/session", session.Version, "0.1.6"},
{"gopkg.in/ini.v1", ini.Version, "1.2.0"},
}
@@ -123,9 +124,18 @@ func newMacaron() *macaron.Macaron {
Funcs: []template.FuncMap{base.TemplateFuncs},
IndentJSON: macaron.Env != macaron.PROD,
}))
+
+ localeNames, err := bindata.AssetDir("conf/locale")
+ if err != nil {
+ log.Fatal(4, "Fail to list locale files: %v", err)
+ }
+ localFiles := make(map[string][]byte)
+ for _, name := range localeNames {
+ localFiles[name] = bindata.MustAsset("conf/locale/" + name)
+ }
m.Use(i18n.I18n(i18n.Options{
SubURL: setting.AppSubUrl,
- Directory: path.Join(setting.ConfRootPath, "locale"),
+ Files: localFiles,
CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
Langs: setting.Langs,
Names: setting.Names,
@@ -457,7 +467,7 @@ func runWeb(ctx *cli.Context) {
// robots.txt
m.Get("/robots.txt", func(ctx *middleware.Context) {
if setting.HasRobotsTxt {
- ctx.ServeFile(path.Join(setting.CustomPath, "robots.txt"))
+ ctx.ServeFileContent(path.Join(setting.CustomPath, "robots.txt"))
} else {
ctx.Error(404)
}