summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramaia <alexandre.maia@gmail.com>2016-10-17 05:53:12 -0700
committeramaia <alexandre.maia@gmail.com>2016-10-18 05:06:02 -0700
commit9c8c5e9dc050f32cec05f6903105ff34d726979b (patch)
tree91a74e2f1eddf65e43e2499242ebaded7082ff39
parentc9d7ba4d696bfd0198ac75db6e1b2a08b4517f82 (diff)
downloadgitlab-ce-9c8c5e9dc050f32cec05f6903105ff34d726979b.tar.gz
fix: commit messages being double-escaped in activies tab
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/banzai/filter/html_entity_filter.rb2
-rw-r--r--spec/lib/banzai/filter/html_entity_filter_spec.rb5
3 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90379e011d6..5d6d5bc591c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -119,6 +119,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Cleanup Ci::ApplicationController. !6757 (Takuya Noguchi)
- Fixes padding in all clipboard icons that have .btn class
- Fix a typo in doc/api/labels.md
+ - Fix double-escaping in activities tab (Alexandre Maia)
- API: all unknown routing will be handled with 404 Not Found
- Add docs for request profiling
- Make guests unable to view MRs on private projects
diff --git a/lib/banzai/filter/html_entity_filter.rb b/lib/banzai/filter/html_entity_filter.rb
index e008fd428b0..f3bd587c28b 100644
--- a/lib/banzai/filter/html_entity_filter.rb
+++ b/lib/banzai/filter/html_entity_filter.rb
@@ -5,7 +5,7 @@ module Banzai
# Text filter that escapes these HTML entities: & " < >
class HtmlEntityFilter < HTML::Pipeline::TextFilter
def call
- ERB::Util.html_escape(text)
+ ERB::Util.html_escape_once(text)
end
end
end
diff --git a/spec/lib/banzai/filter/html_entity_filter_spec.rb b/spec/lib/banzai/filter/html_entity_filter_spec.rb
index 4c68ce6d6e4..f9e6bd609f0 100644
--- a/spec/lib/banzai/filter/html_entity_filter_spec.rb
+++ b/spec/lib/banzai/filter/html_entity_filter_spec.rb
@@ -11,4 +11,9 @@ describe Banzai::Filter::HtmlEntityFilter, lib: true do
expect(output).to eq(escaped)
end
+
+ it 'does not double-escape' do
+ escaped = ERB::Util.html_escape("Merge branch 'blabla' into 'master'")
+ expect(filter(escaped)).to eq(escaped)
+ end
end