FIX: Don't raise an exception if a topic cannot be retrieved (#9906)

This commit is contained in:
Roman Rizzi 2020-05-28 11:59:20 -03:00 committed by GitHub
parent 0e9a380b13
commit a41476800b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -116,7 +116,7 @@ class TopicEmbed < ActiveRecord::Base
)
url = fd.resolve
raise URI::InvalidURIError if url.blank?
return if url.blank?
opts = {
tags: %w[div p code pre h1 h2 h3 b em i strong a img ul li ol blockquote],

View File

@ -311,9 +311,10 @@ describe TopicEmbed do
end
context "non-http URL" do
let(:url) { '/test.txt' }
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