Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
tweak(Felamimail/AttachmentCache): improve 404 handling
Browse files Browse the repository at this point in the history
... convert Felamimail_Exception_IMAPMessageNotFound to Tinebase_Exception_NotFound
  • Loading branch information
pschuele committed Feb 13, 2023
1 parent 20c9adb commit c044bf7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tine20/Felamimail/Controller/AttachmentCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ public function get($_id, $_containerId = null, $_getRelatedData = true, $_getDe
}

/**
* inspect creation of one record (before create)
*
* @param Felamimail_Model_AttachmentCache $_record
* @return void
* @param Felamimail_Model_AttachmentCache $_record
* @return void
* @throws Tinebase_Exception_InvalidArgument
* @throws Tinebase_Exception_NotFound
* @throws Tinebase_Exception_Record_DefinitionFailure
* @throws Tinebase_Exception_Record_Validation
* @throws Tinebase_Exception_SystemGeneric
* @throws Zend_Mime_Exception
*/
protected function _inspectBeforeCreate(Tinebase_Record_Interface $_record)
{
Expand All @@ -153,8 +157,12 @@ protected function _inspectBeforeCreate(Tinebase_Record_Interface $_record)
$fileName = $attachment['filename'];

} else {
$msgPart = $ctrl->getMessagePart($_record->{Felamimail_Model_AttachmentCache::FLD_SOURCE_ID},
$_record->{Felamimail_Model_AttachmentCache::FLD_PART_ID});
try {
$msgPart = $ctrl->getMessagePart($_record->{Felamimail_Model_AttachmentCache::FLD_SOURCE_ID},
$_record->{Felamimail_Model_AttachmentCache::FLD_PART_ID});
} catch (Felamimail_Exception_IMAPMessageNotFound $feiamnf) {
throw new Tinebase_Exception_NotFound($feiamnf->getMessage());
}
$stream = $msgPart->getDecodedStream();
$fileName = $msgPart->filename;
}
Expand Down

0 comments on commit c044bf7

Please sign in to comment.