Browse Source

templates/repo/issue: rework escape delete branch link after merged pull request (#4601)

pull/5181/head
Unknwon 7 years ago
parent
commit
f89d948c06
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 3
      routes/repo/issue.go
  2. 2
      templates/repo/issue/view_content.tmpl

3
routes/repo/issue.go

@ -23,6 +23,7 @@ import (
"github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/form"
"github.com/gogits/gogs/pkg/markup" "github.com/gogits/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/template"
"github.com/gogits/gogs/pkg/tool" "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) && c.Repo.IsWriter() && c.Repo.GitRepo.IsBranchExist(pull.HeadBranch) &&
!branchProtected !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"]) c.Data["DeleteBranchLink"] = fmt.Sprintf("%s?commit=%s&redirect_to=%s", deleteBranchUrl, pull.MergedCommitID, c.Data["Link"])
} }

2
templates/repo/issue/view_content.tmpl

@ -165,7 +165,7 @@
{{if .IsPullBranchDeletable}} {{if .IsPullBranchDeletable}}
<div class="ui divider"></div> <div class="ui divider"></div>
<div> <div>
<form class="ui form" action="{{EscapePound .DeleteBranchLink}}" method="post"> <form class="ui form" action="{{.DeleteBranchLink}}" method="post">
{{.CSRFTokenHTML}} {{.CSRFTokenHTML}}
<button class="ui red button">{{$.i18n.Tr "repo.pulls.delete_branch"}}</button> <button class="ui red button">{{$.i18n.Tr "repo.pulls.delete_branch"}}</button>
</form> </form>

Loading…
Cancel
Save