FIX: crash on invalid uri component
This commit is contained in:
parent
6dbd6f7428
commit
84836944e8
|
@ -263,7 +263,7 @@ module PrettyText
|
|||
uri = URI(href)
|
||||
site_uri ||= URI(Discourse.base_url)
|
||||
link["href"] = "#{site_uri}#{link['href']}" unless uri.host.present?
|
||||
rescue URI::InvalidURIError
|
||||
rescue URI::InvalidURIError, URI::InvalidComponentError
|
||||
# leave it
|
||||
end
|
||||
end
|
||||
|
|
|
@ -266,4 +266,11 @@ describe PrettyText do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'format_for_email' do
|
||||
it 'does not crash' do
|
||||
PrettyText.format_for_email('<a href="mailto:michael.brown@discourse.org?subject=Your%20post%20at%20http://try.discourse.org/t/discussion-happens-so-much/127/1000?u=supermathie">test</a>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue