From 1338090a8473914a7b90a0cd99217a55fb22ade3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 24 May 2019 15:10:48 +0200 Subject: [PATCH] * CalDAV/CardDAV: encoding VT (vertical tab) as it stalls Outlook (CalDav Synchronizer) --- addressbook/inc/class.addressbook_vcal.inc.php | 4 ++-- api/src/CalDAV/Handler.php | 7 +++++++ calendar/inc/class.calendar_ical.inc.php | 2 +- infolog/inc/class.infolog_ical.inc.php | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/addressbook/inc/class.addressbook_vcal.inc.php b/addressbook/inc/class.addressbook_vcal.inc.php index 5f1f7d7e78..24dac95dba 100644 --- a/addressbook/inc/class.addressbook_vcal.inc.php +++ b/addressbook/inc/class.addressbook_vcal.inc.php @@ -388,7 +388,7 @@ class addressbook_vcal extends addressbook_bo { $options['ENCODING'] = 'FUNAMBOL-QP'; } - elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + elseif (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; } @@ -467,7 +467,7 @@ class addressbook_vcal extends addressbook_bo { $options['ENCODING'] = 'FUNAMBOL-QP'; } - elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + elseif (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; } diff --git a/api/src/CalDAV/Handler.php b/api/src/CalDAV/Handler.php index 1999c82243..c7d5983083 100644 --- a/api/src/CalDAV/Handler.php +++ b/api/src/CalDAV/Handler.php @@ -114,6 +114,13 @@ abstract class Handler */ var $new_id; + /** + * Regular expression to identify content requiring QUOTED-PRINTABLE encoding + * + * Used in {addressbook,calendar,infolog}/inc/class.*cal.inc.php + */ + const REQUIRE_QUOTED_PRINTABLE_ENCODING = '/([\000-\012\013\015\016\020-\037\075])/'; + /** * Constructor * diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 80086fd3d5..61e7764f17 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -1034,7 +1034,7 @@ class calendar_ical extends calendar_boupdate else { $paramData['CHARSET'] = ''; - if (preg_match('/([\000-\012\015\016\020-\037\075])/', $valueData)) + if (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $valueData)) { $paramData['ENCODING'] = 'QUOTED-PRINTABLE'; } diff --git a/infolog/inc/class.infolog_ical.inc.php b/infolog/inc/class.infolog_ical.inc.php index b48288875d..6cce3cf524 100644 --- a/infolog/inc/class.infolog_ical.inc.php +++ b/infolog/inc/class.infolog_ical.inc.php @@ -309,7 +309,7 @@ class infolog_ical extends infolog_bo { $options['CHARSET'] = ''; - if (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + if (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; } @@ -990,7 +990,7 @@ class infolog_ical extends infolog_bo { $options['CHARSET'] = ''; - if (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + if (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; }