From 8cec92ea87d5319b42f2c3f904bbf9111b8b4337 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 17 Nov 2021 16:59:51 -0500 Subject: [PATCH] fix(calendar): truncate long UIDs to avoid SQL insert error --- SoObjects/Appointments/SOGoAppointmentFolder.m | 2 +- SoObjects/Appointments/iCalEvent+SOGo.m | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 0c02f06c7..9749dbcb6 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -3367,7 +3367,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir // we generate a new UID based on a GUID uid = [event uid]; - if (![uid length] || + if (![uid length] || [uid length] > 250 || [uid rangeOfCharacterFromSet: [NSCharacterSet characterSetWithCharactersInString: @"+/"]].location != NSNotFound) { uid = [self globallyUniqueObjectId]; diff --git a/SoObjects/Appointments/iCalEvent+SOGo.m b/SoObjects/Appointments/iCalEvent+SOGo.m index 1710a91c7..0e710affa 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.m +++ b/SoObjects/Appointments/iCalEvent+SOGo.m @@ -90,6 +90,9 @@ startDate = [self startDate]; endDate = [self endDate]; uid = [self uid]; + if ([uid length] > 255) + uid = [uid substringToIndex: 255]; + title = [self summary]; if (![title isNotNull]) title = @"";