]> source.dussan.org Git - gitea.git/commitdiff
Stop double encoding blame commit messages (#17498)
authorzeripath <art27@cantab.net>
Sun, 31 Oct 2021 08:25:24 +0000 (08:25 +0000)
committerGitHub <noreply@github.com>
Sun, 31 Oct 2021 08:25:24 +0000 (10:25 +0200)
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>
routers/web/repo/blame.go

index c2da8e9cdca53162a9eefc824e56b2b8c43953db..3632d1846eaeb2a634ce7680177bfbb3ac74d9bc 100644 (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
                        }