From 8053bde1a2aa1df1371075781267d952c5a9c8f5 Mon Sep 17 00:00:00 2001 From: Felix Freiberger Date: Mon, 4 Jul 2016 11:29:12 +0200 Subject: [PATCH] Generate proper URIs for iframes in emails (#4042) --- lib/email/styles.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/email/styles.rb b/lib/email/styles.rb index a8d646ddff1..c9158645715 100644 --- a/lib/email/styles.rb +++ b/lib/email/styles.rb @@ -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 "

#{display_src}

" + 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 "

#{CGI.escapeHTML(display_src)}

" rescue URI::InvalidURIError # If the URL is weird, remove it i.remove