Fix legacy redirect for tree, fix code tab escape

Signed-off-by: Robin Durner <github@nubenum.de>
This commit is contained in:
nubenum 2018-06-13 22:37:26 +02:00
parent 06991dfb69
commit 1237382d65
2 changed files with 3 additions and 2 deletions

View File

@ -619,9 +619,10 @@ 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,
path.Dir(ctx.Req.URL.String()),
strings.TrimSuffix(unescaped, ctx.Params("*")),
(&url.URL{Path: ctx.Repo.BranchNameSubURL()}).String(),
ctx.Repo.TreePath))
return

View File

@ -48,7 +48,7 @@
<div class="ui tabs container">
<div class="ui tabular stackable menu navbar">
{{if .Repository.UnitEnabled $.UnitTypeCode}}
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}">
<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
</a>
{{end}}