wrong link generated for "repository" in sidebar

Steps to reproduce

  1. Browse the history of a wiki page, inside your project
  2. click on "v{1,2,3,4}" whatever.
  3. Now click on "Repository" link from sidebar.

Example

If your wiki page version_id is ?version_id=999bda46585dfff59f2e9692b6ba7eda890b4d85

the generated link for "Repository" would be group/project/-/tree/999bda46585dfff59f2e9692b6ba7eda890b4d85

output of gitlab-rake gitlab:env:info CE

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	3.2.8
Gem Version:	3.7.1
Bundler Version:2.7.1
Rake Version:	13.0.6
Redis Version:	7.2.11
Sidekiq Version:7.3.9
Go Version:	unknown

GitLab information
Version:	18.8.4
Revision:	a11b8d53073
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	16.11
URL:		https://ltd.uk
HTTP Clone URL:	https://ltd.uk/some-group/some-project.git
SSH Clone URL:	git@ltd.uk:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.45.5
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	18.8.4
- default Git Version: 	2.52.GIT
Edited by 🤖 GitLab Bot 🤖