Skip to content
Snippets Groups Projects
Commit e5cc8e0a authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'dm-catch-uri-errors' into 'master'

Catch all URI errors in ExternalLinkFilter

Closes #32076

See merge request !11494
parents 12762caf 110f5a16
No related branches found
No related tags found
2 merge requests!12073Add RC2 changes to 9-3-stable,!11494Catch all URI errors in ExternalLinkFilter
Pipeline #
---
title: Catch all URI errors in ExternalLinkFilter
merge_request:
author:
Loading
Loading
@@ -24,7 +24,7 @@ module Banzai
 
def uri(href)
URI.parse(href)
rescue URI::InvalidURIError
rescue URI::Error
nil
end
 
Loading
Loading
Loading
Loading
@@ -55,6 +55,13 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
 
expect(doc.to_html).to eq(expected)
end
it 'skips improperly formatted mailtos' do
doc = filter %q(<p><a href="mailto://jblogs@example.com">Email</a></p>)
expected = %q(<p><a href="mailto://jblogs@example.com">Email</a></p>)
expect(doc.to_html).to eq(expected)
end
end
 
context 'for links with a username' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment