Skip to content

Commit 95a773e

Browse files
committed
Allow youtube-nocookie iframe domain
1 parent 2cee6e7 commit 95a773e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/helpers/better_together/content_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module ContentHelper
1717

1818
YOUTUBE_DOMAINS = %w[
1919
youtube.com www.youtube.com m.youtube.com youtu.be
20+
youtube-nocookie.com www.youtube-nocookie.com
2021
].freeze
2122

2223
def safe_html(html)

spec/helpers/better_together/content_helper_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ module BetterTogether
2626
expect(output).to include('src="https://www.youtube.com/embed/xyz"')
2727
end
2828

29+
it 'allows youtube-nocookie iframes' do
30+
input = '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/xyz" frameborder="0" allowfullscreen></iframe>'
31+
output = helper.safe_html(input)
32+
expect(output).to include('<iframe')
33+
expect(output).to include('src="https://www.youtube-nocookie.com/embed/xyz"')
34+
end
35+
2936
it 'strips non-youtube iframes' do
3037
input = '<iframe src="https://evil.com/video"></iframe>'
3138
output = helper.safe_html(input)

0 commit comments

Comments
 (0)