Skip to content

Commit

Permalink
Stop double encoding blame commit messages (#17498)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
zeripath authored Oct 31, 2021
1 parent 1ff944f commit 4e8a817
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions routers/web/repo/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package repo

import (
"fmt"
"html"
gotemplate "html/template"
"net/http"
"strings"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 4e8a817

Please sign in to comment.