From fd461ca5553df53f64509e37a567feed40dae700 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 15 Nov 2019 20:13:58 +0800 Subject: [PATCH] fix wrong system notice when repository is empty (#9020) --- routers/repo/middlewares.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go index 6ff09cb84..e513189f6 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) {