From ab20dbb70c2bb7ea34b4319e8028721db459ffa6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 30 Apr 2020 10:15:58 +0200 Subject: [PATCH] * Mail: automatic remove some invisible Unicode chars breaking email addresses: zero width space, variation selectors --- api/src/Etemplate/Widget/Url.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/Etemplate/Widget/Url.php b/api/src/Etemplate/Widget/Url.php index 5dc3dbfc68..afaf2eb7b0 100644 --- a/api/src/Etemplate/Widget/Url.php +++ b/api/src/Etemplate/Widget/Url.php @@ -32,7 +32,9 @@ class Url extends Etemplate\Widget * but NOT: * - "Becker, Ralf " (contains comma outside " or ' enclosed block) * - "Becker < Ralf " (contains < ----------- " ---------------) - * - ToDo: "\u200Bfrancesca.klein@ikem.de" (starts with a "zero width space") + * automatic cleaning of common mistakes (makes no sense to complain about them, as they are not visible to the user) + * - "\u200Bfrancesca.klein@ikem.de" (starts with an unicode "zero width space") + * - "info︃@joswieg.de" (Unicode variation selector "\uFE0X" before the @, meaning eg. not to be displayed as Emotji) * * About umlaut or IDN domains: we currently only allow German umlauts in domain part! * Client-side forbids all non-ascii chars in local part, as Horde does not yet support SMTPUTF8 extension (rfc6531) @@ -119,6 +121,8 @@ class Url extends Etemplate\Widget } break; case 'url-email': + // some automatic cleaning: unicode variation selectors, zero width space + $value = preg_replace('/[\x{FE00}-\x{FE0F}\x{200B}]/u', '', $value); $this->attrs['preg'] = self::EMAIL_PREG; break; }