Skip to content

Commit 709a376

Browse files
authored
Fix link to Code tab on wiki commits (#28041)
Fixes https://codeberg.org/forgejo/forgejo/issues/1759 If you are bowing another branch than the default branch and click n the Code tab, it will take you to the root of the branch. The `BranchName` variable is also set when viewing a Wiki commit, so we also need to check if we are on a Wiki.
1 parent 0a0e820 commit 709a376

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: templates/repo/header.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
143143
<div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
144144
{{if .Permission.CanRead $.UnitTypeCode}}
145-
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
145+
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
146146
{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
147147
</a>
148148
{{end}}

0 commit comments

Comments
 (0)