Branches with `/` in them don't render correctly in tree view

Summary

Browsing the files in a repository will display nothing when clicking into directories for branches with a / in them

Steps to reproduce

  1. Create a new project with a branch this/has-a-slash
  2. Add a new folder containing a file to the branch, e.g. test-folder/test-file.md
  3. From the project view click into the folder (e.g. from https://gitlab-instance.com/test-project/-/tree/this/has-a-slash)
  4. Observe that the URL has been re-written to https://gitlab-instance.com/test-project/-/tree/this%2Fhas-a-slash/test-folder and no files are visible.

Manually rewriting the URL to https://gitlab-instance.com/test-project/-/tree/this/has-a-slash/test-folder will work.

Example Project

As a result of setting vue_file_list to false, this cannot be reproduced on GitLab.com

Reproduced here: https://gitlab.lyle.work/NewGuy/test-with-slash/-/tree/branch-with/slash

Running on GitLab Enterprise Edition 12.10.0-pre 7626fad2e3b

What is the current bug behavior?

Navigating the file tree on branches with / in them will not display files.

What is the expected correct behavior?

Files should be displayed.

Relevant logs and/or screenshots

Broken: image

Expected: image

Output of checks

(If you are reporting a bug on GitLab.com, write: 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)

Related

Edited by Lyle Kozloff