Skip to content

A platform for community discussion. Free, open, simple.

DEV: do not persist force_custom_user_agent_hosts setting

Penar Musaraj4b6a47be4836
diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb
index 0c2e74f6995..80b3085933b 100644
--- a/lib/oneboxer.rb
+++ b/lib/oneboxer.rb
@@ -31,7 +31,7 @@ module Oneboxer
end
def self.force_custom_user_agent_hosts
- @force_custom_user_agent_hosts ||= SiteSetting.force_custom_user_agent_hosts.split('|')
+ SiteSetting.force_custom_user_agent_hosts.split('|')
end
def self.allowed_post_types
diff --git a/spec/components/oneboxer_spec.rb b/spec/components/oneboxer_spec.rb
index 520825d0f1d..c5bc2dca861 100644
--- a/spec/components/oneboxer_spec.rb
+++ b/spec/components/oneboxer_spec.rb
@@ -3,10 +3,6 @@
require 'rails_helper'
describe Oneboxer do
- before do
- SiteSetting.force_custom_user_agent_hosts = "http://codepen.io|https://video.discourse.org/"
- end
-
it "returns blank string for an invalid onebox" do
stub_request(:head, "http://boom.com")
stub_request(:get, "http://boom.com").to_return(body: "")
@@ -174,6 +170,7 @@ describe Oneboxer do
end
it "uses the Onebox custom user agent on specified hosts" do
+ SiteSetting.force_custom_user_agent_hosts = "http://codepen.io|https://video.discourse.org/"
url = 'https://video.discourse.org/presentation.mp4'
stub_request(:head, url).to_return(status: 403, body: "", headers: {})