FIX: Skip absolutizing URLs when source URI is invalid

This commit is contained in:
Penar Musaraj
2020-02-07 10:54:24 -05:00
parent 88a4d5a2c1
commit 99fd65328c
2 changed files with 15 additions and 1 deletions

View File

@ -310,4 +310,14 @@ describe TopicEmbed do
end
end
describe '.absolutize_urls' do
let(:invalid_url) { 'http://source.com/#double#anchor' }
let(:contents) { "hello world new post <a href='/hello'>hello</a>" }
it "does not attempt absolutizing on a bad URI" do
raw = TopicEmbed.absolutize_urls(invalid_url, contents)
expect(raw).to eq(contents)
end
end
end