Stage names are double escaped in when output in HTML on GitLab

Summary

CI/CD stages with a & in the name get rendered as &; the HTML is doubly escaped.

Steps to reproduce

Name a CI/CD stage with a &. E.g., this is an abbreviated version of the .gitlab-ci.yml my project used:

stages:
  - "Lint & Test"

lint:
  stage: "Lint & Test"
  allow_failure: false
  image:
    name: ubuntu:xenial
  script:
    - 'echo "Hello, world."'
  tags:
    - docker-pull-always

Example Project

Example Project Demonstrating the Bug

What is the current bug behavior?

(Note: We are self hosted, however, the bug appears to also be present on GitLab.com.)

Here is a screenshot of what we see, when using something like the above:

Ampersand is doubly escaped

What is the expected correct behavior?

Just "Lint & Test"

We also went with this unusual name b/c before that, we had used more "identifier" like names, such as lint_and_test; however, the same screen will capitalize the name, resulting in "Lint_and_test", which is IMO ugly.

Note that the "pipelines" page listing all pipelines (https://.../{group}/{project}/pipelines) does not exhibit either behavior. (Neither doubly escaping nor randomly capitalizing the first letter.) That is, the pipelines listing page works perfectly!

Relevant logs and/or screenshots

N/A / Above.

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

This bug happens on GitLab.com, but was discovered on a self-hosted installation of GitLab.

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

(If you can, link to the line of code that might be responsible for the problem)

Assignee Loading
Time tracking Loading