Browse Source

Fix bug in conversion of email addresses to mailto links in plain text messages (#7526)

pull/7561/head
Aleksander Machniak 5 years ago
parent
commit
53bc7b7615
  1. 1
      CHANGELOG
  2. 8
      program/lib/Roundcube/rcube_string_replacer.php
  3. 6
      tests/Framework/StringReplacer.php

1
CHANGELOG

@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail
- Elastic: Fix redundant scrollbar in plain text editor on mail reply (#7500)
- Elastic: Fix deleted and replied+forwarded icons on messages list (#7503)
- Managesieve: Allow angle brackets in out-of-office message body (#7518)
- Fix bug in conversion of email addresses to mailto links in plain text messages (#7526)
- Fix format=flowed formatting on plain text part derived from the HTML content (#7504)
- Fix incorrect rewriting of internal links in HTML content (#7512)
- Fix handling links without defined protocol (#7454)

8
program/lib/Roundcube/rcube_string_replacer.php

@ -59,10 +59,10 @@ class rcube_string_replacer
$this->linkref_pattern = '/\[([^\]#]+)\]/';
$this->link_pattern = "/$link_prefix($utf_domain([$url1]*[$url2]+)*)/";
$this->mailto_pattern = "/("
."[-\w!\#\$%&\'*+~\/^`|{}=]+(?:\.[-\w!\#\$%&\'*+~\/^`|{}=]+)*" // local-part
."@$utf_domain" // domain-part
."(\?[$url1$url2]+)?" // e.g. ?subject=test...
.")/";
. "[-\w!\#\$%&*+~\/^`|{}=]+(?:\.[-\w!\#\$%&*+~\/^`|{}=]+)*" // local-part
. "@$utf_domain" // domain-part
. "(\?[$url1$url2]+)?" // e.g. ?subject=test...
. ")/";
}
/**

6
tests/Framework/StringReplacer.php

@ -39,8 +39,10 @@ class Framework_StringReplacer extends PHPUnit_Framework_TestCase
array('https://github.com/a/b/compare/3a0f82...1f4b2a after', '<a href="https://github.com/a/b/compare/3a0f82...1f4b2a">https://github.com/a/b/compare/3a0f82...1f4b2a</a> after'),
array('http://<test>', 'http://<test>'),
array('http://', 'http://'),
array('test@www.test', '<a href="mailto:test@www.test">test@www.test</a>'),
array('1@1.com www.domain.tld', '<a href="mailto:1@1.com">1@1.com</a> <a href="http://www.domain.tld">www.domain.tld</a>'),
array('test test@www.test test', 'test <a href="mailto:test@www.test">test@www.test</a> test'),
array("test 'test@www.test' test", "test '<a href=\"mailto:test@www.test\">test@www.test</a>' test"),
array('test "test@www.test" test', 'test "<a href="mailto:test@www.test">test@www.test</a>" test'),
array('a 1@1.com www.domain.tld', 'a <a href="mailto:1@1.com">1@1.com</a> <a href="http://www.domain.tld">www.domain.tld</a>'),
array(' www.domain.tld ', ' <a href="http://www.domain.tld">www.domain.tld</a> '),
array(' www.domain.tld/#!download|856p1|2 ', ' <a href="http://www.domain.tld/#!download|856p1|2">www.domain.tld/#!download|856p1|2</a> '),
// #1489898: allow some unicode characters

Loading…
Cancel
Save