From 756eafaaf68b3cadb3f33f37554a6aa2d83921ef Mon Sep 17 00:00:00 2001 From: nubenum Date: Mon, 17 Sep 2018 00:28:23 +0200 Subject: [PATCH] Fix some issues with special chars in branch names (#3767) Signed-off-by: Robin Durner --- templates/repo/activity.tmpl | 2 +- templates/repo/branch/list.tmpl | 4 ++-- templates/repo/commits_table.tmpl | 4 ++-- templates/repo/editor/edit.tmpl | 4 ++-- templates/repo/header.tmpl | 2 +- templates/repo/home.tmpl | 2 +- templates/repo/issue/view.tmpl | 2 +- templates/repo/pulls/commits.tmpl | 2 +- templates/repo/pulls/files.tmpl | 2 +- templates/repo/release/list.tmpl | 16 ++++++++-------- templates/repo/settings/branches.tmpl | 4 ++-- templates/user/dashboard/feeds.tmpl | 7 ++++--- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl index ed959c5b0198f..19866d53d77b4 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 2ef96defa2961..ce0558e92b8dc 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 ec433974c923c..53c2f98f4df95 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 5625ac1000a22..b08838cac8831 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 5312a49bec811..bf052301555b2 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 99bac62cfabfb..d084f9bc5aa04 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 fb46919f88e83..b771dc37fdc3e 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 54cbb7b447212..7337b8ca0ed23 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 78950183b9b9c..8bd1a80f40fef 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}}