From 50252d803e1ae10dbad08d7a2d606ac6361fabf4 Mon Sep 17 00:00:00 2001 From: jbrw Date: Wed, 7 Apr 2021 13:32:27 -0400 Subject: [PATCH] DEV: stub youtube embed requests (#12637) * DEV: stub youtube embed requests * DEV: Ignore redirects on youtube.com when oneboxing --- lib/oneboxer.rb | 2 +- spec/components/oneboxer_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb index c30c4e98dec..bdca6e35749 100644 --- a/lib/oneboxer.rb +++ b/lib/oneboxer.rb @@ -23,7 +23,7 @@ module Oneboxer end def self.ignore_redirects - @ignore_redirects ||= ['http://www.dropbox.com', 'http://store.steampowered.com', 'http://vimeo.com', Discourse.base_url] + @ignore_redirects ||= ['http://www.dropbox.com', 'http://store.steampowered.com', 'http://vimeo.com', 'https://www.youtube.com', Discourse.base_url] end def self.amazon_domains diff --git a/spec/components/oneboxer_spec.rb b/spec/components/oneboxer_spec.rb index c2adaa818b9..1868ec20b6d 100644 --- a/spec/components/oneboxer_spec.rb +++ b/spec/components/oneboxer_spec.rb @@ -207,6 +207,7 @@ describe Oneboxer do before do stub_request(:any, "https://www.youtube.com/watch?v=dQw4w9WgXcQ").to_return(status: 200, body: html) + stub_request(:any, "https://www.youtube.com/embed/dQw4w9WgXcQ").to_return(status: 403, body: nil) end it "allows restricting engines based on the allowed_onebox_iframes setting" do