mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -142,7 +142,7 @@
 | 
			
		||||
		{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
 | 
			
		||||
			<div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
 | 
			
		||||
				{{if .Permission.CanRead $.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 and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
 | 
			
		||||
					{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
 | 
			
		||||
				</a>
 | 
			
		||||
				{{end}}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user