diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-10-19 13:56:08 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-10-19 13:56:08 +0000 |
commit | cc46a0d47c5660583455c203a93f3333af42f4a8 (patch) | |
tree | deef0c7ac7a1bd2468a576556c7971a8abc3e7d4 | |
parent | 12f649fe2a83dd637aeb700fc98cdcfcd9ac2100 (diff) | |
parent | 9c8c5e9dc050f32cec05f6903105ff34d726979b (diff) | |
download | gitlab-ce-cc46a0d47c5660583455c203a93f3333af42f4a8.tar.gz |
Merge branch 'fix-escaping' into 'master'
fix: commit messages being double-escaped in activities tab
See merge request !6937
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/banzai/filter/html_entity_filter.rb | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/html_entity_filter_spec.rb | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f1ef9238c10..c866696889e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -122,6 +122,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 - Delete dynamic environments 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 |