FIX: don't break when posting invalid URIs
This commit is contained in:
parent
74b812593c
commit
45850a0cd6
|
@ -118,7 +118,7 @@ SQL
|
|||
.map do |u|
|
||||
uri = begin
|
||||
URI.parse(u.url)
|
||||
rescue URI::InvalidURIError
|
||||
rescue URI::Error
|
||||
end
|
||||
|
||||
[u, uri]
|
||||
|
|
|
@ -169,6 +169,14 @@ http://b.com/#{'a' * 500}
|
|||
end
|
||||
end
|
||||
|
||||
context "email address" do
|
||||
it "does not extract a link" do
|
||||
post = topic.posts.create(user: user, raw: "Valid email: foo@bar.com\n\nInvalid email: rfc822;name@domain.com")
|
||||
TopicLink.extract_from(post)
|
||||
expect(topic.topic_links).to be_blank
|
||||
end
|
||||
end
|
||||
|
||||
context "mail link" do
|
||||
let(:post) { topic.posts.create(user: user, raw: "[email]bar@example.com[/email]") }
|
||||
|
||||
|
|
Loading…
Reference in New Issue