From 23fbf5e1eef8985d8223e5c34e92e8bd2c97bac4 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 12 Sep 2022 00:16:56 +0200 Subject: Show .editorconfig errors in frontend (#21088) If the user views the .editorconfig of the Repo, an the the .editorconfig contains error, those errors are now shown above the file. --- routers/web/repo/view.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'routers/web') diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index cdfb4b9906..65c8ab92cf 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -374,6 +374,11 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st ctx.Data["FileName"] = blob.Name() ctx.Data["RawFileLink"] = rawLink + "/" + util.PathEscapeSegments(ctx.Repo.TreePath) + if ctx.Repo.TreePath == ".editorconfig" { + _, editorconfigErr := ctx.Repo.GetEditorconfig() + ctx.Data["FileError"] = editorconfigErr + } + buf := make([]byte, 1024) n, _ := util.ReadAtMost(dataRc, buf) buf = buf[:n] -- cgit v1.2.3