Browse Source

templates/repo: escape branch name (#4601)

pull/5209/head
Unknwon 7 years ago
parent
commit
15f9a83618
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 4
      cmd/hook.go
  2. 2
      gogs.go
  3. 2
      templates/.VERSION
  4. 2
      templates/repo/home.tmpl

4
cmd/hook.go

@ -236,9 +236,9 @@ func runHookPostReceive(c *cli.Context) error {
log.Error(2, "PushUpdate: %v", err) log.Error(2, "PushUpdate: %v", err)
} }
// Ask for running deliver hook and test pull request tasks. // Ask for running deliver hook and test pull request tasks
reqURL := setting.LocalURL + options.RepoUserName + "/" + options.RepoName + "/tasks/trigger?branch=" + reqURL := setting.LocalURL + options.RepoUserName + "/" + options.RepoName + "/tasks/trigger?branch=" +
strings.TrimPrefix(options.RefFullName, git.BRANCH_PREFIX) + template.EscapePound(strings.TrimPrefix(options.RefFullName, git.BRANCH_PREFIX)) +
"&secret=" + os.Getenv(http.ENV_REPO_OWNER_SALT_MD5) + "&secret=" + os.Getenv(http.ENV_REPO_OWNER_SALT_MD5) +
"&pusher=" + os.Getenv(http.ENV_AUTH_USER_ID) "&pusher=" + os.Getenv(http.ENV_AUTH_USER_ID)
log.Trace("Trigger task: %s", reqURL) log.Trace("Trigger task: %s", reqURL)

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/setting"
) )
const APP_VER = "0.11.47.0425" const APP_VER = "0.11.48.0425"
func init() { func init() {
setting.AppVer = APP_VER setting.AppVer = APP_VER

2
templates/.VERSION

@ -1 +1 @@
0.11.47.0425 0.11.48.0425

2
templates/repo/home.tmpl

@ -25,7 +25,7 @@
<div class="ui secondary menu"> <div class="ui secondary menu">
{{if .PullRequestCtx.Allowed}} {{if .PullRequestCtx.Allowed}}
<div class="fitted item"> <div class="fitted item">
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.PullRequestCtx.HeadInfo}}"> <a href="{{.BaseRepo.Link}}/compare/{{EscapePound .BaseRepo.DefaultBranch}}...{{EscapePound .PullRequestCtx.HeadInfo}}">
<button class="ui green small button"><i class="octicon octicon-git-compare"></i></button> <button class="ui green small button"><i class="octicon octicon-git-compare"></i></button>
</a> </a>
</div> </div>

Loading…
Cancel
Save