From 792aca6823966f0d464ed05388dbf813d103285d Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Mon, 12 Oct 2015 20:58:13 -0400 Subject: Issue #2392109 by jacob.embree, sumitmadan, ByronNorris, dcmul, ckaotik, jhedstrom: Filter: Allow plus sign in email addresses --- CHANGELOG.txt | 2 ++ modules/filter/filter.module | 2 +- modules/filter/filter.test | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 064d007d2..c2e0bf389 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,8 @@ Drupal 7.40, xxxx-xx-xx (development version) ----------------------- +- Fixed the URL text filter to convert e-mail addresses with plus signs into + mailto: links. - Added alternate text to file icons displayed by the File module, to improve accessibility (string change, and minor API addition to theme_file_icon()). - Changed one-time login link failure messages to be displayed as errors or diff --git a/modules/filter/filter.module b/modules/filter/filter.module index edf7aa98b..c710ee700 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -1497,7 +1497,7 @@ function _filter_url($text, $filter) { $tasks['_filter_url_parse_full_links'] = $pattern; // Match e-mail addresses. - $url_pattern = "[A-Za-z0-9._-]{1,254}@(?:$domain)"; + $url_pattern = "[A-Za-z0-9._+-]{1,254}@(?:$domain)"; $pattern = "`($url_pattern)`"; $tasks['_filter_url_parse_email_links'] = $pattern; diff --git a/modules/filter/filter.test b/modules/filter/filter.test index 1565c0c57..d558fa3be 100644 --- a/modules/filter/filter.test +++ b/modules/filter/filter.test @@ -1294,6 +1294,7 @@ class FilterUnitTestCase extends DrupalUnitTestCase { // Create a e-mail that is too long. $long_email = str_repeat('a', 254) . '@example.com'; $too_long_email = str_repeat('b', 255) . '@example.com'; + $email_with_plus_sign = 'one+two@example.com'; // Filter selection/pattern matching. @@ -1307,12 +1308,13 @@ http://example.com or www.example.com ), // MAILTO URLs. ' -person@example.com or mailto:person2@example.com or ' . $long_email . ' but not ' . $too_long_email . ' +person@example.com or mailto:person2@example.com or ' . $email_with_plus_sign . ' or ' . $long_email . ' but not ' . $too_long_email . ' ' => array( 'person@example.com' => TRUE, 'mailto:person2@example.com' => TRUE, '' . $long_email . '' => TRUE, '' . $too_long_email . '' => FALSE, + '' . $email_with_plus_sign . '' => TRUE, ), // URI parts and special characters. ' -- cgit v1.2.3