summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-09-05 17:50:47 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-09-10 15:08:06 -0400
commit7cbf5e4d18f6ba0bf1afbddcb090fa39837e9529 (patch)
tree672522ec84e0ef60efccf001313bcc3370064141
parentb2f3d024c3775f9d8dc293c433da103381ed6e45 (diff)
downloadgitlab-ce-7cbf5e4d18f6ba0bf1afbddcb090fa39837e9529.tar.gz
Prevent result of SyntaxHighlightFilter being sanitized
-rw-r--r--lib/gitlab/markdown/sanitization_filter.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/markdown/sanitization_filter.rb b/lib/gitlab/markdown/sanitization_filter.rb
index 68ed57f6257..54faf981b7d 100644
--- a/lib/gitlab/markdown/sanitization_filter.rb
+++ b/lib/gitlab/markdown/sanitization_filter.rb
@@ -67,12 +67,16 @@ module Gitlab
def clean_spans
lambda do |env|
- return unless env[:node_name] == 'span'
- return unless env[:node].has_attribute?('class')
+ node = env[:node]
- unless has_ancestor?(env[:node], 'pre')
- env[:node].remove_attribute('class')
+ return unless node.name == 'span'
+ return unless node.has_attribute?('class')
+
+ unless has_ancestor?(node, 'pre')
+ node.remove_attribute('class')
end
+
+ {node_whitelist: [node]}
end
end
end