forked from extern/egroupware
avoid fatal error on getContents when no part is found
This commit is contained in:
parent
204d73ab52
commit
ae1e4707de
@ -5025,11 +5025,16 @@ class emailadmin_imapbase
|
||||
}
|
||||
$ext = mime_magic::mime2ext($structure_mime);
|
||||
if ($ext && stripos($filename,'.')===false && stripos($filename,$ext)===false) $filename = trim($filename).'.'.$ext;
|
||||
//error_log(__METHOD__.__LINE__.'#'.$structure_mime.'#'.$filename);
|
||||
if (!$part)
|
||||
{
|
||||
error_log(__METHOD__.__LINE__.'Error: Could not fetch attachment for:'." Uid:$_uid, PartId:$_partID, WinMailNr:$_winmail_nr in $_folder:".array2string(function_backtrace()));
|
||||
error_log(__METHOD__.__LINE__.'# Fetched StructureMime:'.$structure_mime.' with Filename:'.$filename);
|
||||
}
|
||||
$attachmentData = array(
|
||||
'type' => $structure_mime,
|
||||
'filename' => $filename,
|
||||
'attachment' => $part->getContents(array('stream'=>$_stream))
|
||||
//'attachment' => $part->getContents(array('stream'=>$_stream))
|
||||
'attachment' => ($part?$part->getContents(array('stream'=>$_stream)):'Error: Could not fetch attachment for:'." Uid:$_uid, PartId:$_partID, WinMailNr:$_winmail_nr in $_folder:".array2string(function_backtrace()))
|
||||
);
|
||||
|
||||
// try guessing the mimetype, if we get the application/octet-stream
|
||||
|
Loading…
Reference in New Issue
Block a user