diff options
author | Unknwon <u@gogs.io> | 2017-02-01 07:24:20 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-01 07:24:20 -0500 |
commit | 2527037973441054692ee11446196d3ac6b135c3 (patch) | |
tree | 12ff4ed35ec4f7a12f04387251efe7ffedd20239 /routers | |
parent | 1d951cfc4915d9beb12b9e2e9fcd178069e4ce02 (diff) |
routers/repo: minor code fix for PR #3758
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/middlewares.go | 23 | ||||
-rw-r--r-- | routers/repo/view.go | 9 |
2 files changed, 9 insertions, 23 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go deleted file mode 100644 index 2c344420..00000000 --- a/routers/repo/middlewares.go +++ /dev/null @@ -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 -} diff --git a/routers/repo/view.go b/routers/repo/view.go index 7d9278e7..18c79e08 100644 --- a/routers/repo/view.go +++ b/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) { title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name if len(ctx.Repo.Repository.Description) > 0 { |