trigger to fetch attachments as BODY instead of BINARY on failed BINARY was not called caused by an early exit from function

This commit is contained in:
Klaus Leithoff 2015-08-18 14:32:50 +00:00
parent 7efaea763d
commit 2b6ddcd127

View File

@ -4261,11 +4261,12 @@ class emailadmin_imapbase
$part = $this->icServer->fetch($_folder, $fquery, array(
'ids' => $uidsToFetch,
))->first();
if (!$part) return null;
$partToReturn = null;
if ($part)
{
$_encoding = $part->getBodyPartDecode($_partID);
$partToReturn = $part->getBodyPart($_partID, $_stream);
}
// if we get an empty result, server may have trouble fetching data with UID FETCH $_uid (BINARY.PEEK[$_partID])
// thus we trigger a second go with UID FETCH $_uid (BODY.PEEK[$_partID])
if (empty($partToReturn)&&$_tryDecodingServerside===true)
@ -4273,7 +4274,7 @@ class emailadmin_imapbase
error_log(__METHOD__.__LINE__.' failed to fetch bodyPart in BINARY. Try BODY');
$partToReturn = $this->getBodyPart($_uid, $_partID, $_folder, $_preserveSeen, $_stream, $_encoding, false);
}
return $partToReturn;
return ($partToReturn?$partToReturn:null);
}
/**