Browse Source

routers/repo: minor code fix for PR #3758

Unknwon 8 years ago
parent
commit
2527037973
4 changed files with 11 additions and 25 deletions
  1. 1 1
      gogs.go
  2. 0 23
      routers/repo/middlewares.go
  3. 9 0
      routers/repo/view.go
  4. 1 1
      templates/.VERSION

+ 1 - 1
gogs.go

@@ -16,7 +16,7 @@ import (
 	"github.com/gogits/gogs/modules/setting"
 	"github.com/gogits/gogs/modules/setting"
 )
 )
 
 
-const APP_VER = "0.9.130.0131"
+const APP_VER = "0.9.131.0201"
 
 
 func init() {
 func init() {
 	setting.AppVer = APP_VER
 	setting.AppVer = APP_VER

+ 0 - 23
routers/repo/middlewares.go

@@ -1,23 +0,0 @@
-package repo
-
-import (
-	"fmt"
-
-	"github.com/gogits/git-module"
-	"github.com/gogits/gogs/models"
-	"github.com/gogits/gogs/modules/context"
-)
-
-func setEditorconfigIfExists(ctx *context.Context) {
-	ec, err := ctx.Repo.GetEditorconfig()
-
-	if err != nil && !git.IsErrNotExist(err) {
-		description := fmt.Sprintf("Error while getting .editorconfig file: %v", err)
-		if err := models.CreateRepositoryNotice(description); err != nil {
-			ctx.Handle(500, "ErrCreatingReporitoryNotice", err)
-		}
-		return
-	}
-
-	ctx.Data["Editorconfig"] = ec
-}

+ 9 - 0
routers/repo/view.go

@@ -211,6 +211,15 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
 	}
 	}
 }
 }
 
 
+func setEditorconfigIfExists(ctx *context.Context) {
+	ec, err := ctx.Repo.GetEditorconfig()
+	if err != nil && !git.IsErrNotExist(err) {
+		log.Error(4, "Fail to get '.editorconfig' [%d]: %v", ctx.Repo.Repository.ID, err)
+		return
+	}
+	ctx.Data["Editorconfig"] = ec
+}
+
 func Home(ctx *context.Context) {
 func Home(ctx *context.Context) {
 	title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
 	title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
 	if len(ctx.Repo.Repository.Description) > 0 {
 	if len(ctx.Repo.Repository.Description) > 0 {

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.9.130.0131
+0.9.131.0201