Parse found links as URIs
This commit is contained in:
@@ -18,7 +18,7 @@ module Adamantium
|
|||||||
links.reject do |link|
|
links.reject do |link|
|
||||||
link.end_with?(":") ||
|
link.end_with?(":") ||
|
||||||
IGNORE_LIST.include?(URI.parse(link).host)
|
IGNORE_LIST.include?(URI.parse(link).host)
|
||||||
end
|
end.map{ |uri| URI(uri) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -6,6 +6,6 @@ RSpec.describe Adamantium::LinkFinder do
|
|||||||
it "finds allowed links in a string" do
|
it "finds allowed links in a string" do
|
||||||
text = "Check out some of these cool websites: https://google.com https://example.com or even http://twitter.com and https://bsky.app"
|
text = "Check out some of these cool websites: https://google.com https://example.com or even http://twitter.com and https://bsky.app"
|
||||||
|
|
||||||
expect(subject.call(text)).to eq ["https://example.com"]
|
expect(subject.call(text)).to eq [URI("https://example.com")]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user