Generate proper URIs for iframes in emails (#4042)

This commit is contained in:
Felix Freiberger 2016-07-04 11:29:12 +02:00 committed by Régis Hanol
parent 87e3b3cb9a
commit 8053bde1a2
1 changed files with 2 additions and 2 deletions

View File

@ -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