'Find file' link is incorrect, coming from a file view
Summary
When navigating from a folder, to a file, and to a the Find file page, all the links are prefixed by the previous filename.
Steps to reproduce
- Go to a folder page (eg. https://gitlab.com/gitlab-org/gitlab/-/tree/master)
- Click on a file. Needs to be in the same tab! (eg. https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md)
- Click on Find file button. URL is https://gitlab.com/gitlab-org/gitlab/-/find_file/master/README.md. The filename is incorrectly added to the URL.
- Click on any files in the result. Error message:
"README.md/.browserslistrc" did not exist on "master"
Example Project
What is the current bug behavior?
The filename previously seen is prepended to each results.
What is the expected correct behavior?
- When clicking the Find file button, it should not append the filename in the URL
- On the Find file page, it should ignore any characters after
-/find_file/{ref-name}/
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com. Also happens in v14.10.3
Results of GitLab environment info
Expand for output related to GitLab environment info
root@git:~# sudo gitlab-rake gitlab:env:info System information System: Debian 10 Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.5p203 Gem Version: 3.1.4 Bundler Version:2.2.33 Rake Version: 13.0.6 Redis Version: 6.2.6 Sidekiq Version:6.4.0 Go Version: unknown GitLab information Version: 14.10.3-ee Revision: d118e6c477f Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.7 URL: http://git.mt-c.local HTTP Clone URL: http://git.mt-c.local/some-group/some-project.git SSH Clone URL: git@git.mt-c.local:some-group/some-project.git Elasticsearch: yes Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 13.25.1 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)