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

Commit

Permalink
Merge branch 'pu/ps/attachCache404' into '2022.11'
Browse files Browse the repository at this point in the history
tweak(Felamimail/AttachmentCache): improve 404 handling

See merge request tine20/tine20!3442
  • Loading branch information
pschuele committed Feb 13, 2023
2 parents 74a8ad8 + 4a7d3b9 commit 4c3a99a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions tine20/Felamimail/Controller/AttachmentCache.php
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 Expand Up @@ -265,7 +273,11 @@ public function fillAttachmentCache(array $accountIds, ?int $seconds = null): vo
}
} finally {
Tinebase_FileSystem::getInstance()->_getTreeNodeBackend()->doSynchronousPreviewCreation($old);
Tinebase_Core::releaseMultiServerLock($lockKey);
try {
Tinebase_Core::releaseMultiServerLock($lockKey);
} catch (Tinebase_Exception_Backend $teb) {
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' ' . $teb->getMessage());
}
}
}
}

0 comments on commit 4c3a99a

Please sign in to comment.