FIX: Don't raise an exception if a topic cannot be retrieved (#9906)
This commit is contained in:
parent
0e9a380b13
commit
a41476800b
|
@ -116,7 +116,7 @@ class TopicEmbed < ActiveRecord::Base
|
||||||
)
|
)
|
||||||
|
|
||||||
url = fd.resolve
|
url = fd.resolve
|
||||||
raise URI::InvalidURIError if url.blank?
|
return if url.blank?
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
tags: %w[div p code pre h1 h2 h3 b em i strong a img ul li ol blockquote],
|
tags: %w[div p code pre h1 h2 h3 b em i strong a img ul li ol blockquote],
|
||||||
|
|
|
@ -311,9 +311,10 @@ describe TopicEmbed do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "non-http URL" do
|
context "non-http URL" do
|
||||||
let(:url) { '/test.txt' }
|
|
||||||
it "throws an error" do
|
it "throws an error" do
|
||||||
expect { TopicEmbed.find_remote(url) }.to raise_error(URI::InvalidURIError)
|
url = '/test.txt'
|
||||||
|
|
||||||
|
expect(TopicEmbed.find_remote(url)).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue