HTTP 404 when branch name contains '#'
Summary
Error message in UI: "An error occurred while fetching commit data." when branch name contains "#" (wihout quotes)
Steps to reproduce
- Code/Branches/ New branch
- Branch name should contain the character "#" (without quotes), e.g. J#CR-1234.
- Finalize creating branch
- Go to Code / Repository, select newly created branch from drop down.
Example Project
What is the current bug behavior?
Error message in UI: "An error occurred while fetching commit data." This appears at the top of the page.
On my local installation running 16.11.1, the same thing happens. Checking the gitlab_access.log nginx log I can see the following:
[30/Apr/2024:09:48:09 +0300] "GET /mscortar/testing_ground/-/refs/J?format=json&offset=0&ref_type=heads HTTP/2.0" 404 20...
Apparently, the branch name is truncated at the # location.
What is the expected correct behavior?
Definitely no error on screen and no 404 in log. Not sure what else should happen in this case, it does not seems like it is breaking something.
Relevant logs and/or screenshots
[30/Apr/2024:09:48:09 +0300] "GET /mscortar/testing_ground/-/refs/J?format=json&offset=0&ref_type=heads HTTP/2.0" 404 20...
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)