diff options
author | Robert Speicher <robert@gitlab.com> | 2016-07-06 18:11:20 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-07-06 18:11:20 +0300 |
commit | 3df58f149979f98af9b52c9e08dd63d17344d1df (patch) | |
tree | d36a3cda8139af4bebd8ea37530e9b67c3fff619 /lib | |
parent | be018ba8c4f61babfea494a3946df9931d476a8a (diff) | |
parent | e89a515ce953a6805d512e005cef4034b337c182 (diff) |
Merge branch 'gh-labels' into 'master'
Allow `?`, or `&` for label names
Closes #18727
See merge request !4724
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/label_reference_filter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb index e4d3f87d0aa..e258dc8e2bf 100644 --- a/lib/banzai/filter/label_reference_filter.rb +++ b/lib/banzai/filter/label_reference_filter.rb @@ -13,13 +13,13 @@ module Banzai end def self.references_in(text, pattern = Label.reference_pattern) - text.gsub(pattern) do |match| + unescape_html_entities(text).gsub(pattern) do |match| yield match, $~[:label_id].to_i, $~[:label_name], $~[:project], $~ end end def references_in(text, pattern = Label.reference_pattern) - text.gsub(pattern) do |match| + unescape_html_entities(text).gsub(pattern) do |match| label = find_label($~[:project], $~[:label_id], $~[:label_name]) if label @@ -66,6 +66,10 @@ module Banzai LabelsHelper.render_colored_cross_project_label(object) end end + + def unescape_html_entities(text) + CGI.unescapeHTML(text.to_s) + end end end end |