From cb31d4faa9ce71808aabc572bc16207a15d4060e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 4 Jun 2018 14:47:55 -0400 Subject: [PATCH] (fix) also try to get event using its UID before bailing out --- ActiveSync/SOGoActiveSyncDispatcher+Sync.m | 2 +- ActiveSync/SOGoActiveSyncDispatcher.m | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index e15cb53b5..29405b58d 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -189,7 +189,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. processIdentifierInCache = [[self globalMetadataForDevice] objectForKey: key]; // Don't update the cache if another request is processing the same collection. - // I case of a merged folder we have to check personal folder's lock. + // In case of a merged folder we have to check personal folder's lock. a = [key componentsSeparatedByString: @"/"]; pkey = [NSString stringWithFormat: @"%@/personal", [a objectAtIndex:0]]; diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 35cdf8f05..dd5dc0871 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -290,6 +290,39 @@ void handle_eas_terminate(int signum) return theIdToTranslate; } +// +// +// +- (SOGoAppointmentObject *) _eventObjectWithUID: (NSString *) uid +{ + SOGoAppointmentFolder *folder; + SOGoAppointmentObject *eventObject; + NSArray *folders; + NSEnumerator *e; + NSString *cname; + + eventObject = nil; + + folders = [[[context activeUser] calendarsFolderInContext: context] subFolders]; + e = [folders objectEnumerator]; + while (eventObject == nil && (folder = [e nextObject])) + { + cname = [folder resourceNameForEventUID: uid]; + if (cname) + { + eventObject = [folder lookupName: cname inContext: context + acquire: NO]; + if ([eventObject isKindOfClass: [NSException class]]) + eventObject = nil; + } + } + + if (eventObject) + return eventObject; + else + return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; +} + // // // @@ -1848,6 +1881,9 @@ void handle_eas_terminate(int signum) inContext: context acquire: NO]; + if ([appointmentObject isKindOfClass: [NSException class]]) + appointmentObject = [self _eventObjectWithUID:[event uid]]; + // Create the appointment if it is not added to calendar yet if ([appointmentObject isKindOfClass: [NSException class]]) {