(fix) handle emails having an attachment as their content

pull/101/head^2
Ludovic Marcotte 2015-11-05 15:21:13 -05:00
parent 350fe2e7e0
commit ab322093cd
2 changed files with 14 additions and 3 deletions

2
NEWS
View File

@ -27,7 +27,7 @@ Bug fixes
- freebusy on web interface works again in multidomain environments (Zentyal) - freebusy on web interface works again in multidomain environments (Zentyal)
- fix double creation of folders in Outlook when the folder name starts with a digit (Zentyal) - fix double creation of folders in Outlook when the folder name starts with a digit (Zentyal)
- avoid crashing Outlook after setting a custom view in a calendar folder (Zentyal) - avoid crashing Outlook after setting a custom view in a calendar folder (Zentyal)
- handle emails having an attachment as their content
2.3.2 (2015-09-16) 2.3.2 (2015-09-16)
------------------ ------------------

View File

@ -389,8 +389,11 @@ static BOOL debugSoParts = NO;
[[[info valueForKey: @"subtype"] lowercaseString] isEqualToString: @"calendar"]) [[[info valueForKey: @"subtype"] lowercaseString] isEqualToString: @"calendar"])
return info; return info;
if ([[[info valueForKey: @"type"] lowercaseString] isEqualToString: @"application"] && // deal with mails that contain only an attachment, for example:
[[[info valueForKey: @"subtype"] lowercaseString] isEqualToString: @"pkcs7-mime"]) // application/pkcs7-mime
// application/pdf
// etc.
if ([[[info valueForKey: @"type"] lowercaseString] isEqualToString: @"application"])
return info; return info;
/* /*
@ -1044,6 +1047,14 @@ static BOOL debugSoParts = NO;
return obj; return obj;
} }
} }
// Handles cases where the email is itself an attachment, so its Content-Type
// is application/*, image/* etc.
else if ([_key isEqualToString: @"asAttachment"] &&
(obj = [self lookupImap4BodyPartKey: @"0" inContext:_ctx]) != nil)
{
[obj setAsAttachment];
return obj;
}
/* return 404 to stop acquisition */ /* return 404 to stop acquisition */
return [NSException exceptionWithHTTPStatus:404 /* Not Found */ return [NSException exceptionWithHTTPStatus:404 /* Not Found */