From 957151937fb2f0a6195a632320768231773b5bc3 Mon Sep 17 00:00:00 2001 From: "Max P." <46793832+0xMax42@users.noreply.github.com> Date: Tue, 23 Dec 2025 07:26:29 +0100 Subject: [PATCH] Fix panic in blame view when a file has only a single commit (#36230) This PR fixes a panic in the repository blame view that occurs when rendering files whose blame history consists of only a single commit. --- routers/web/repo/blame.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/blame.go b/routers/web/repo/blame.go index 0e95a9d023..ab3aecbbe7 100644 --- a/routers/web/repo/blame.go +++ b/routers/web/repo/blame.go @@ -271,7 +271,7 @@ func renderBlame(ctx *context.Context, blameParts []*gitrepo.BlamePart, commitNa unsafeLines := highlight.UnsafeSplitHighlightedLines(highlighted) for i, br := range rows { var line template.HTML - if i < len(rows) { + if i < len(unsafeLines) { line = template.HTML(util.UnsafeBytesToString(unsafeLines[i])) } br.EscapeStatus, br.Code = charset.EscapeControlHTML(line, ctx.Locale)