diff --git a/include/class.file.php b/include/class.file.php index 204b7945fe4051d02b988578b89d309e7d99807f..2316301535b672fc4c8f6fc35283ba74bd3fc1cd 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -388,12 +388,15 @@ class AttachmentFile extends VerySimpleModel { $file['data'] = base64_decode($file['data']); } } - if (isset($file['data'])) { + + if (!isset($file['data']) && isset($file['dataclb']) + && is_callable($file['dataclb'])) { // Allow a callback function to delay or avoid reading or // fetching ihe file contents - if (is_callable($file['data'])) - $file['data'] = $file['data'](); + $file['data'] = $file['dataclb'](); + } + if (isset($file['data'])) { list($key, $file['signature']) = self::_getKeyAndHash($file['data']); if (!$file['key']) diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index dd7edd815653fee8a8fb3f0a81e79863dc3d9a94..d814d1d9fe6289aa20bf0747b84fb1b7aa9b6f62 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -831,7 +831,7 @@ class MailFetcher { else { // only fetch the body if necessary $self = $this; - $file['data'] = function() use ($self, $mid, $a) { + $file['dataclb'] = function() use ($self, $mid, $a) { return $self->decode(imap_fetchbody($self->mbox, $mid, $a['index']), $a['encoding']); };