Branch naming convention breaks file preview

Summary

Following a branch naming convention such as issues/# (ex. issues/#101) breaks the file preview after reloading the page. I believe that the issue is being caused by the "#" within the branch name. This was reported on 18.4.2 on a self-managed instance by a US Government customer. It can also be reproduced on gitlab.com.

How the file looks before reloading: Before_Refresh

How the file looks after reloading: After_Refresh

Steps to reproduce

This has been reproduced on 18.4.1, 18.4.2 and Gitlab.com.

  1. In a project create a branch named issues/#101.
  2. In the issues/#101 branch create a new file, type anything that you want as the filename and the body.
  3. Return to the file within the issues/#101 branch, you should be able to see its contents.
  4. Reload the page while on the file, you will see that the file preview does not display.

What is the current bug behavior?

Following a branch naming convention such as issues/# (ex. issues/#101) breaks the file preview after reloading the page.

What is the expected correct behavior?

Reloading the page when using a naming convention such as issues/#101 should not break the file preview.

Output of checks

This bug happens on GitLab.com

Possible fixes

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by 🤖 GitLab Bot 🤖