summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-15 18:53:20 +0800
committerzeripath <art27@cantab.net>2019-11-15 10:53:20 +0000
commitc0c26240795bee28d2601296013c81db81bbd32c (patch)
treef67bae642c147e72687f10d11f1e88b8ba84ff7a
parent21ae9838e04233bbf9930d368d935fd1f9b68c34 (diff)
downloadgitea-c0c26240795bee28d2601296013c81db81bbd32c.tar.gz
gitea-c0c26240795bee28d2601296013c81db81bbd32c.zip
fix wrong system notice when repository is empty (#9010)
-rw-r--r--routers/repo/middlewares.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go
index 6ff09cb845..e513189f6b 100644
--- a/routers/repo/middlewares.go
+++ b/routers/repo/middlewares.go
@@ -10,6 +10,11 @@ import (
// SetEditorconfigIfExists set editor config as render variable
func SetEditorconfigIfExists(ctx *context.Context) {
+ if ctx.Repo.Repository.IsEmpty {
+ ctx.Data["Editorconfig"] = nil
+ return
+ }
+
ec, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {