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.
This commit is contained in:
Max P.
2025-12-23 07:26:29 +01:00
committed by GitHub
parent 04607f7d4a
commit 957151937f
+1 -1
View File
@@ -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)