mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:05:24 +08:00
Merge pull request #5018 from discourse/wekbit-embedded-referer
FIX: First load of embed comments would always fail on WebKit
This commit is contained in:
commit
40fc6c429a
|
@ -32,6 +32,9 @@ class EmbeddableHost < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.url_allowed?(url)
|
||||
# Work around IFRAME reload on WebKit where the referer will be set to the Forum URL
|
||||
return true if url&.starts_with?(Discourse.base_url)
|
||||
|
||||
uri = URI(URI.encode(url)) rescue nil
|
||||
uri.present? && record_for_url(uri).present?
|
||||
end
|
||||
|
|
|
@ -78,6 +78,10 @@ describe EmbeddableHost do
|
|||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com')).to eq(true)
|
||||
expect(EmbeddableHost.url_allowed?('http://discourse.org')).to eq(true)
|
||||
end
|
||||
|
||||
it 'always allow forum own URL' do
|
||||
expect(EmbeddableHost.url_allowed?(Discourse.base_url)).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe "path_whitelist" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user