(fix) prevent characters in calendar component UID causing issues during import process

pull/101/head^2
Ludovic Marcotte 2015-12-01 09:26:52 -05:00
parent fdb36970d4
commit d51d5c85b0
2 changed files with 18 additions and 7 deletions

1
NEWS
View File

@ -13,6 +13,7 @@ Bug fixes
- EAS fix for wrong charset being used (#3392)
- EAS fix on qp-encoded subjects (#3390)
- correctly handle all-day event exceptions when the master event changes
- prevent characters in calendar component UID causing issues during import process
2.3.3a (2015-11-18)
-------------------

View File

@ -3160,19 +3160,29 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
NSMutableString *content;
NSString *uid;
// We first look if there's an event with the same UID in our calendar. If not,
// let's reuse what is in the event, otherwise generate a new GUID and use it.
// We first look if the event has any / or + in its UID. If that's the case
// we generate a new UID based on a GUID
uid = [event uid];
object = [self lookupName: uid
inContext: context
acquire: NO];
if (object && ![object isKindOfClass: [NSException class]])
if ([uid rangeOfCharacterFromSet: [NSCharacterSet characterSetWithCharactersInString: @"+/"]].location != NSNotFound)
{
uid = [self globallyUniqueObjectId];
[event setUid: uid];
}
else
{
// We also look if there's an event with the same UID in our calendar. If not,
// let's reuse what is in the event, otherwise generate a new GUID and use it.
object = [self lookupName: uid
inContext: context
acquire: NO];
if (object && ![object isKindOfClass: [NSException class]])
{
uid = [self globallyUniqueObjectId];
[event setUid: uid];
}
}
object = [SOGoAppointmentObject objectWithName: uid
inContainer: self];