Generate proper URIs for iframes in emails (#4042)
This commit is contained in:
parent
87e3b3cb9a
commit
8053bde1a2
|
@ -132,8 +132,8 @@ module Email
|
|||
src_uri = URI(i['src'])
|
||||
|
||||
# If an iframe is protocol relative, use SSL when displaying it
|
||||
display_src = "#{src_uri.scheme || 'https://'}#{src_uri.host}#{src_uri.path}"
|
||||
i.replace "<p><a href='#{src_uri.to_s}'>#{display_src}</a><p>"
|
||||
display_src = "#{src_uri.scheme || 'https'}://#{src_uri.host}#{src_uri.path}#{src_uri.query.nil? ? '' : '?' + src_uri.query}#{src_uri.fragment.nil? ? '' : '#' + src_uri.fragment}"
|
||||
i.replace "<p><a href='#{src_uri.to_s}'>#{CGI.escapeHTML(display_src)}</a><p>"
|
||||
rescue URI::InvalidURIError
|
||||
# If the URL is weird, remove it
|
||||
i.remove
|
||||
|
|
Loading…
Reference in New Issue