Fixed issue #952 - External links in html emails will be open in local context.
This commit is contained in:
parent
5868fdd19f
commit
b3ae159c2e
3 changed files with 15 additions and 2 deletions
|
@ -132,6 +132,10 @@ satinize html string based on whiltelist
|
||||||
# prepare links
|
# prepare links
|
||||||
if node['href']
|
if node['href']
|
||||||
href = cleanup_target(node['href'])
|
href = cleanup_target(node['href'])
|
||||||
|
if external && !href.downcase.start_with?('//') && href.downcase !~ %r{^.{1,6}://.+?}
|
||||||
|
node['href'] = "http://#{node['href']}"
|
||||||
|
href = node['href']
|
||||||
|
end
|
||||||
next if !href.downcase.start_with?('http', 'ftp', '//')
|
next if !href.downcase.start_with?('http', 'ftp', '//')
|
||||||
node.set_attribute('href', href)
|
node.set_attribute('href', href)
|
||||||
node.set_attribute('rel', 'nofollow')
|
node.set_attribute('rel', 'nofollow')
|
||||||
|
|
|
@ -663,6 +663,15 @@ Men-----------------------'
|
||||||
result = "<a href=\"http://facebook.de/examplesrbog\" rel=\"nofollow\" target=\"_blank\">http://facebook.de/examplesrbog</a>"
|
result = "<a href=\"http://facebook.de/examplesrbog\" rel=\"nofollow\" target=\"_blank\">http://facebook.de/examplesrbog</a>"
|
||||||
assert_equal(result, html.html2html_strict)
|
assert_equal(result, html.html2html_strict)
|
||||||
|
|
||||||
|
html = "<span style=\"font-size:10.0pt;font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:DE\">web
|
||||||
|
<a href=\"http://www.example.de\"><span style=\"color:blue\">www.example.de</span></a><o:p></o:p></span>"
|
||||||
|
result = "web <a href=\"http://www.example.de\" rel=\"nofollow\" target=\"_blank\">www.example.de</a>"
|
||||||
|
assert_equal(result, html.html2html_strict)
|
||||||
|
|
||||||
|
html = "web <a href=\"www.example.de\"><span style=\"color:blue\">www.example.de</span></a>"
|
||||||
|
result = "web <a href=\"http://www.example.de\" rel=\"nofollow\" target=\"_blank\">www.example.de</a>"
|
||||||
|
assert_equal(result, html.html2html_strict)
|
||||||
|
|
||||||
html = "Damit Sie keinen Tag versäumen, empfehlen wir Ihnen den <a href=\"http://newsletters.cylex.de/\" class=\"\">Link des Adventkalenders</a> in<br class=\"\"> Ihrer Lesezeichen-Symbolleiste zu ergänzen.</p><div class=\"\"> "
|
html = "Damit Sie keinen Tag versäumen, empfehlen wir Ihnen den <a href=\"http://newsletters.cylex.de/\" class=\"\">Link des Adventkalenders</a> in<br class=\"\"> Ihrer Lesezeichen-Symbolleiste zu ergänzen.</p><div class=\"\"> "
|
||||||
result = "Damit Sie keinen Tag versäumen, empfehlen wir Ihnen den Link des Adventkalenders (<a href=\"http://newsletters.cylex.de/\" rel=\"nofollow\" target=\"_blank\">http://newsletters.cylex.de/</a>) in<br> Ihrer Lesezeichen-Symbolleiste zu ergänzen.<div> </div>"
|
result = "Damit Sie keinen Tag versäumen, empfehlen wir Ihnen den Link des Adventkalenders (<a href=\"http://newsletters.cylex.de/\" rel=\"nofollow\" target=\"_blank\">http://newsletters.cylex.de/</a>) in<br> Ihrer Lesezeichen-Symbolleiste zu ergänzen.<div> </div>"
|
||||||
assert_equal(result, html.html2html_strict)
|
assert_equal(result, html.html2html_strict)
|
||||||
|
|
|
@ -244,7 +244,7 @@ Managing Director: Martin Edenhofer
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
data: IO.binread('test/fixtures/mail8.box'),
|
data: IO.binread('test/fixtures/mail8.box'),
|
||||||
body_md5: '630aa1cc84fcaee8a0f232908c454c5f',
|
body_md5: 'ec01ac06deb1997b09b0afbbe49e316f',
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
md5: 'c3ca4aab222eed8a148a716371b70129',
|
md5: 'c3ca4aab222eed8a148a716371b70129',
|
||||||
|
@ -281,7 +281,7 @@ Düsseldorfer Landstraße 395
|
||||||
<br>
|
<br>
|
||||||
D-00000 Hof
|
D-00000 Hof
|
||||||
<br>
|
<br>
|
||||||
<a href="www.example.com"><u><a href="http://www.example.com" rel="nofollow" target="_blank">http://www.example.com</a></u></a> <br>
|
<a href="http://www.example.com" rel="nofollow" target="_blank"><u><a href="http://www.example.com" rel="nofollow" target="_blank">http://www.example.com</a></u></a> <br>
|
||||||
<br> <hr>
|
<br> <hr>
|
||||||
<br>
|
<br>
|
||||||
Geschäftsführung/Management Board: Jan Bauer (Vorsitzender/Chairman), Oliver Bauer, Heiko Bauer, Boudewijn Bauer
|
Geschäftsführung/Management Board: Jan Bauer (Vorsitzender/Chairman), Oliver Bauer, Heiko Bauer, Boudewijn Bauer
|
||||||
|
|
Loading…
Reference in a new issue