diff --git a/modules/context/repo.go b/modules/context/repo.go index 7239b353f..61cda5e2d 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -8,6 +8,7 @@ package context import ( "fmt" "io/ioutil" + "net/url" "path" "strings" @@ -623,10 +624,11 @@ func RepoRefByType(refType RepoRefType) macaron.Handler { if refType == RepoRefLegacy { // redirect from old URL scheme to new URL scheme + unescaped, _ := url.PathUnescape(ctx.Req.URL.String()) ctx.Redirect(path.Join( setting.AppSubURL, - strings.TrimSuffix(ctx.Req.URL.String(), ctx.Params("*")), - ctx.Repo.BranchNameSubURL(), + strings.TrimSuffix(unescaped, ctx.Params("*")), + (&url.URL{Path: ctx.Repo.BranchNameSubURL()}).String(), ctx.Repo.TreePath)) return } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 629d84e05..40b0f7f5d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1612,7 +1612,7 @@ notices.delete_success = The system notices have been deleted. [action] create_repo = created repository %s rename_repo = renamed repository from %[1]s to %[3]s -commit_repo = pushed to %[3]s at %[4]s +commit_repo = pushed to %[3]s at %[4]s create_issue = `opened issue %s#%[2]s` close_issue = `closed issue %s#%[2]s` reopen_issue = `reopened issue %s#%[2]s` @@ -1622,7 +1622,7 @@ reopen_pull_request = `reopened pull request %s#%[2]s` comment_issue = `commented on issue %s#%[2]s` merge_pull_request = `merged pull request %s#%[2]s` transfer_repo = transferred repository %s to %s -push_tag = pushed tag %[2]s to %[3]s +push_tag = pushed tag %[2]s to %[3]s delete_tag = deleted tag %[2]s from %[3]s delete_branch = deleted branch %[2]s from %[3]s compare_commits = Compare %d commits diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl index ed959c5b0..19866d53d 100644 --- a/templates/repo/activity.tmpl +++ b/templates/repo/activity.tmpl @@ -92,7 +92,7 @@
{{$.i18n.Tr "repo.activity.published_release_label"}}
{{.TagName}} {{if not .IsTag}} - {{.Title}} + {{.Title}} {{end}} {{TimeSinceUnix .CreatedUnix $.Lang}}

diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 2ef96defa..ce0558e92 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -38,10 +38,10 @@ {{if .IsDeleted}} - {{.Name}} + {{.Name}}

{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}

{{else}} - {{.Name}} + {{.Name}}

{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

{{end}} diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index ec433974c..53c2f98f4 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -5,7 +5,7 @@
{{if .PageIsCommits}} -
+ @@ -79,4 +79,4 @@
{{end}} -{{template "base/paginate" .}} \ No newline at end of file +{{template "base/paginate" .}} diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 50d8f6828..d4eb6dfb7 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -30,8 +30,8 @@
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index a496b9b91..3d7398c19 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -48,7 +48,7 @@
diff --git a/templates/repo/pulls/commits.tmpl b/templates/repo/pulls/commits.tmpl index 99bac62cf..d084f9bc5 100644 --- a/templates/repo/pulls/commits.tmpl +++ b/templates/repo/pulls/commits.tmpl @@ -5,7 +5,7 @@
diff --git a/templates/repo/pulls/files.tmpl b/templates/repo/pulls/files.tmpl index 7663788c6..8cb006a25 100644 --- a/templates/repo/pulls/files.tmpl +++ b/templates/repo/pulls/files.tmpl @@ -5,7 +5,7 @@
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 54cbb7b44..7337b8ca0 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -28,7 +28,7 @@ {{$.i18n.Tr "repo.release.stable"}} {{end}} - {{.TagName}} + {{.TagName}} {{ShortSha .Sha1}} @@ -38,19 +38,19 @@
{{if .IsTag}}

- {{.TagName}} + {{.TagName}}

{{if $.Repository.UnitEnabled $.UnitTypeCode}} {{ShortSha .Sha1}} - ZIP - TAR.GZ + ZIP + TAR.GZ {{end}}
{{else}}

- {{.Title}} - {{if $.IsRepositoryWriter}}({{$.i18n.Tr "repo.release.edit"}}){{end}} + {{.Title}} + {{if $.IsRepositoryWriter}}({{$.i18n.Tr "repo.release.edit"}}){{end}}

@@ -68,10 +68,10 @@

@@ -62,7 +62,7 @@ {{range .ProtectedBranches}}
{{.BranchName}}
- {{$.i18n.Tr "repo.settings.edit_protected_branch"}} + {{$.i18n.Tr "repo.settings.edit_protected_branch"}} {{else}} {{.i18n.Tr "repo.settings.no_protected_branch"}} diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index d9082a0f1..1d1b80478 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -13,8 +13,8 @@ {{else if eq .GetOpType 2}} {{$.i18n.Tr "action.rename_repo" .GetContent .GetRepoLink .ShortRepoPath | Str2html}} {{else if eq .GetOpType 5}} - {{ $branchLink := .GetBranch | EscapePound}} - {{$.i18n.Tr "action.commit_repo" .GetRepoLink $branchLink .GetBranch .ShortRepoPath | Str2html}} + {{ $branchLink := .GetBranch | EscapePound | Escape}} + {{$.i18n.Tr "action.commit_repo" .GetRepoLink $branchLink (Escape .GetBranch) .ShortRepoPath | Str2html}} {{else if eq .GetOpType 6}} {{ $index := index .GetIssueInfos 0}} {{$.i18n.Tr "action.create_issue" .GetRepoLink $index .ShortRepoPath | Str2html}} @@ -24,7 +24,8 @@ {{else if eq .GetOpType 8}} {{$.i18n.Tr "action.transfer_repo" .GetContent .GetRepoLink .ShortRepoPath | Str2html}} {{else if eq .GetOpType 9}} - {{$.i18n.Tr "action.push_tag" .GetRepoLink .GetBranch .ShortRepoPath | Str2html}} + {{ $branchLink := .GetBranch | EscapePound | Escape}} + {{$.i18n.Tr "action.push_tag" .GetRepoLink $branchLink .ShortRepoPath | Str2html}} {{else if eq .GetOpType 10}} {{ $index := index .GetIssueInfos 0}} {{$.i18n.Tr "action.comment_issue" .GetRepoLink $index .ShortRepoPath | Str2html}}