DEV: stub youtube embed requests (#12637)

DEV: stub youtube embed requests (#12637)

  • DEV: stub youtube embed requests

  • DEV: Ignore redirects on youtube.com when oneboxing

diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb
index c30c4e9..bdca6e3 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 c2adaa8..1868ec2 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

GitHub sha: 50252d80

1 Like

This commit appears in #12637 which was approved by davidtaylorhq. It was merged by jbrw.