From beecaca7db2c210d1dff98b573852541fd9485b7 Mon Sep 17 00:00:00 2001
From: nubenum
Date: Sat, 7 Apr 2018 14:30:19 +0200
Subject: [PATCH 1/5] Fix some issues with special chars in branch names
* Adding `EscapePound` where necessary for `#?`
* Adding `Escape` where `Str2Html` is used to avoid `"` being stripped
* Fix last references to legacy URL scheme where possible
* Fix legacy redirect
Signed-off-by: Robin Durner
---
modules/context/repo.go | 4 ++--
templates/repo/activity.tmpl | 2 +-
templates/repo/branch/list.tmpl | 4 ++--
templates/repo/commits_table.tmpl | 8 ++++----
templates/repo/editor/commit_form.tmpl | 2 +-
templates/repo/editor/edit.tmpl | 4 ++--
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 ++++---
13 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/modules/context/repo.go b/modules/context/repo.go
index f3ae33cb50313..53dbaa3bc66fa 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -619,8 +619,8 @@ func RepoRefByType(refType RepoRefType) macaron.Handler {
// redirect from old URL scheme to new URL scheme
ctx.Redirect(path.Join(
setting.AppSubURL,
- strings.TrimSuffix(ctx.Req.URL.String(), ctx.Params("*")),
- ctx.Repo.BranchNameSubURL(),
+ path.Dir(ctx.Req.URL.String()),
+ strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(ctx.Repo.BranchNameSubURL()),
ctx.Repo.TreePath))
return
}
diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl
index f5454afb9346a..2adc8e44ce610 100644
--- a/templates/repo/activity.tmpl
+++ b/templates/repo/activity.tmpl
@@ -84,7 +84,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 cd6afce9120a1..750526f7a4ee5 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 8a8e2c369e185..e96abd1b29508 100644
--- a/templates/repo/commits_table.tmpl
+++ b/templates/repo/commits_table.tmpl
@@ -5,7 +5,7 @@