From 228d1cc45e431704e895acec4864b6d05633d6c9 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Tue, 6 Sep 2022 13:05:34 +0200 Subject: [PATCH] Show .editorconfig errors in frontend --- routers/web/repo/view.go | 5 +++++ templates/repo/view_file.tmpl | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 24f559fe454da..b6c33d10bef08 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] diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index f06521046e2fb..2b4f279cb6e36 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -1,4 +1,11 @@
+ {{- if .FileError}} +
+
+
{{.FileError}}
+
+
+ {{end}}

{{if .ReadmeInList}}