From cd6c56953b6d7627b313fc7db2e3c0b1c75e1d7c Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 16 Mar 2016 08:55:21 -0400 Subject: [PATCH] (fix) properly split long headers (fixes #3152) Conflicts: ActiveSync/SOGoMailObject+ActiveSync.m --- ActiveSync/SOGoActiveSyncDispatcher.m | 2 +- ActiveSync/SOGoMailObject+ActiveSync.m | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 0a58865475..a1c2c11f71 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -2864,7 +2864,7 @@ - (void) _processSmartCommand: (id ) theDocumentElement { [map setObject: [mailObject messageId] forKey: @"in-reply-to"]; - references = [[[[[mailObject mailHeaders] objectForKey: @"references"] componentsSeparatedByString: @" "] mutableCopy] autorelease]; + references = [[[[[mailObject mailHeaders] objectForKey: @"references"] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] mutableCopy] autorelease]; // If there is no References: header, initialize it with In-Reply-To. if ([mailObject inReplyTo] && ![references count]) diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m index d37f7b3e8d..18a00f09d8 100644 --- a/ActiveSync/SOGoMailObject+ActiveSync.m +++ b/ActiveSync/SOGoMailObject+ActiveSync.m @@ -32,6 +32,8 @@ #import #import #import +#import +#import #import #import @@ -1186,9 +1188,9 @@ - (NSString *) activeSyncRepresentationInContext: (WOContext *) _context value = [[self mailHeaders] objectForKey: @"references"]; if ([value isKindOfClass: [NSArray class]]) - reference = [[[value objectAtIndex: 0] componentsSeparatedByString: @" "] objectAtIndex: 0]; + reference = [[[value objectAtIndex: 0] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] objectAtIndex: 0]; else - reference = [[value componentsSeparatedByString: @" "] objectAtIndex: 0]; + reference = [[value componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] objectAtIndex: 0]; if ([reference length] > 0) [s appendFormat: @"%@", [[reference dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];