Stop double encoding blame commit messages (#17498)

The call to html.EscapeString in routers/web/repo/blame.go:renderBlame is extraneous
as the commit message is now rendered by the template. The template will correctly
escape strings - therefore we are currently double escaping.

This PR fixes this.

Fix #17492

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2021-10-31 08:25:24 +00:00 committed by GitHub
parent 1ff944f698
commit 4e8a81780e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,6 @@ package repo
import (
"fmt"
"html"
gotemplate "html/template"
"net/http"
"strings"
@ -239,7 +238,7 @@ func renderBlame(ctx *context.Context, blameParts []git.BlamePart, commitNames m
br.PreviousSha = previousSha
br.PreviousShaURL = fmt.Sprintf("%s/blame/commit/%s/%s", repoLink, previousSha, ctx.Repo.TreePath)
br.CommitURL = fmt.Sprintf("%s/commit/%s", repoLink, part.Sha)
br.CommitMessage = html.EscapeString(commit.CommitMessage)
br.CommitMessage = commit.CommitMessage
br.CommitSince = commitSince
}