From 36f399bc15d982508844eb1751b6326bd40893c4 Mon Sep 17 00:00:00 2001 From: Adrian Groh Date: Mon, 28 Sep 2026 19:43:35 +0300 Subject: [PATCH] Fix invalid UTF-8 when truncating long event fields Signed-off-by: Adrian Groh --- lib/Service/GoogleCalendarAPIService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/GoogleCalendarAPIService.php b/lib/Service/GoogleCalendarAPIService.php index fb079a8f..15840fb0 100644 --- a/lib/Service/GoogleCalendarAPIService.php +++ b/lib/Service/GoogleCalendarAPIService.php @@ -116,16 +116,16 @@ private function generateEventData(array $e, array $exceptions, int $ncCalId, ar $eventData .= 'COLOR:' . $closestCssColor . "\n"; } $eventData .= isset($e['summary']) - ? ('SUMMARY:' . substr(str_replace("\n", '\n', $e['summary']), 0, 250) . "\n") + ? ('SUMMARY:' . mb_strcut(str_replace("\n", '\n', $e['summary']), 0, 250) . "\n") : (($e['visibility'] ?? '') === 'private' ? ('SUMMARY:' . $this->l10n->t('Private event') . "\n") : ''); $eventData .= isset($e['sequence']) ? ('SEQUENCE:' . $e['sequence'] . "\n") : ''; $eventData .= isset($e['location']) - ? ('LOCATION:' . substr(str_replace("\n", '\n', $e['location']), 0, 250) . "\n") + ? ('LOCATION:' . mb_strcut(str_replace("\n", '\n', $e['location']), 0, 250) . "\n") : ''; $eventData .= isset($e['description']) - ? ('DESCRIPTION:' . substr(str_replace("\n", '\n', $e['description']), 0, 250) . "\n") + ? ('DESCRIPTION:' . mb_strcut(str_replace("\n", '\n', $e['description']), 0, 250) . "\n") : ''; $eventData .= isset($e['status']) ? ('STATUS:' . strtoupper(str_replace("\n", '\n', $e['status'])) . "\n") : '';