Branches dropdown menu routes incorrectly: injects %2F into branch names with / slash

Summary

Branch names like prefix/something cause problems, see steps below. This was reported by a customer in ZD 356759.

Steps to reproduce

See example project:

  1. From the /-/branches page, one can normally navigate to either branch's /-/tree/ page. The expected content is shown
  2. But, when starting on the project's overview page, switching branches via the dropdown menu leads to /-/tree/prefix%2Fsomething, without the expected content.

Example Project

See above

What is the current bug behavior?

See step 2.

What is the expected correct behavior?

Step 2 should behave as step 1 does.

Relevant logs and/or screenshots

Screenshot_2022-12-22_at_17.52.34

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

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)

Possible fixes

Edited by Katrin Leinweber