summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-04-21 20:49:41 +0000
committerRobert Speicher <robert@gitlab.com>2016-04-21 20:49:41 +0000
commit1ea2408ba351646ac60c88136ed8b9acc58c6557 (patch)
tree9722a8ad3feddc1bcf653ac12ebdec6cb618b832 /lib/banzai
parent0ae039d0a1da83d6e9b4cc4ffa20279ed9928a80 (diff)
parent72debd840cb76a5fc0929c0caeca179c39378680 (diff)
downloadgitlab-ce-1ea2408ba351646ac60c88136ed8b9acc58c6557.tar.gz
Merge branch 'dev_issue_15331' into 'master'
Fixes window.opener bug Adds `noreferrer` value to rel attribute for external links REF: https://gitlab.com/gitlab-org/gitlab-ce/issues/15331 See merge request !1953
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/external_link_filter.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/banzai/filter/external_link_filter.rb b/lib/banzai/filter/external_link_filter.rb
index d179bea181e..38c4219518e 100644
--- a/lib/banzai/filter/external_link_filter.rb
+++ b/lib/banzai/filter/external_link_filter.rb
@@ -1,7 +1,6 @@
module Banzai
module Filter
- # HTML Filter to add a `rel="nofollow"` attribute to external links
- #
+ # HTML Filter to modify the attributes of external links
class ExternalLinkFilter < HTML::Pipeline::Filter
def call
doc.search('a').each do |node|
@@ -15,7 +14,7 @@ module Banzai
# Skip internal links
next if link.start_with?(internal_url)
- node.set_attribute('rel', 'nofollow')
+ node.set_attribute('rel', 'nofollow noreferrer')
end
doc