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.
This commit is contained in:
JakobDev 2022-09-12 00:16:56 +02:00 committed by GitHub
parent ec82a24547
commit 23fbf5e1ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -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]