mirror of
https://github.com/go-gitea/gitea
synced 2026-02-03 11:10:40 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user