From c01b21e402af6d7f4bee720d68a89a5d22c397be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Amor=20Garc=C3=ADa?= Date: Sun, 27 Sep 2015 12:32:17 +0200 Subject: [PATCH] oc-mail: Fixed false positive in [MAPIStoreAttachment hasContentId] This method does not longer returns true if the content id was a empty string. In some case the old false positive triggered the removal of attachments when sending messages. --- OpenChange/MAPIStoreMailVolatileMessage.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenChange/MAPIStoreMailVolatileMessage.m b/OpenChange/MAPIStoreMailVolatileMessage.m index 8a7ba2c58..d6154c8e8 100644 --- a/OpenChange/MAPIStoreMailVolatileMessage.m +++ b/OpenChange/MAPIStoreMailVolatileMessage.m @@ -167,9 +167,9 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" }; - (BOOL) hasContentId { - return ([properties - objectForKey: MAPIPropertyKey (PR_ATTACH_CONTENT_ID_UNICODE)] - != nil); + NSString *contentId = [properties + objectForKey: MAPIPropertyKey (PR_ATTACH_CONTENT_ID_UNICODE)]; + return contentId && [contentId length] > 0; } - (NGMimeBodyPart *) asMIMEBodyPart @@ -233,7 +233,7 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" }; [map addObject: contentDisposition forKey: @"content-disposition"]; contentId = [properties objectForKey: MAPIPropertyKey (PR_ATTACH_CONTENT_ID_UNICODE)]; - if (contentId) + if (contentId && [contentId length] > 0) [map setObject: [NSString stringWithFormat: @"<%@>", contentId] forKey: @"content-id"]; bodyPart = [NGMimeBodyPart bodyPartWithHeader: map];