From f89d948c06e19ccb16afac60b47071009b7c7dab Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 16 Apr 2018 23:08:09 -0400 Subject: [PATCH] templates/repo/issue: rework escape delete branch link after merged pull request (#4601) --- routes/repo/issue.go | 3 ++- templates/repo/issue/view_content.tmpl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/routes/repo/issue.go b/routes/repo/issue.go index 41d0df1f1..70535b2e2 100644 --- a/routes/repo/issue.go +++ b/routes/repo/issue.go @@ -23,6 +23,7 @@ import ( "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/markup" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/template" "github.com/gogits/gogs/pkg/tool" ) @@ -657,7 +658,7 @@ func viewIssue(c *context.Context, isPullList bool) { c.Repo.IsWriter() && c.Repo.GitRepo.IsBranchExist(pull.HeadBranch) && !branchProtected - deleteBranchUrl := c.Repo.RepoLink + "/branches/delete/" + pull.HeadBranch + deleteBranchUrl := template.EscapePound(c.Repo.RepoLink + "/branches/delete/" + pull.HeadBranch) c.Data["DeleteBranchLink"] = fmt.Sprintf("%s?commit=%s&redirect_to=%s", deleteBranchUrl, pull.MergedCommitID, c.Data["Link"]) } diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 200710cda..c03b6973b 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -165,7 +165,7 @@ {{if .IsPullBranchDeletable}}
-
+ {{.CSRFTokenHTML}}