Skip to content
Snippets Groups Projects
Commit 68df49b3 authored by Jared Hancock's avatar Jared Hancock
Browse files

tnef: Fix attachment handling when fetching

parent d8981d4b
No related branches found
No related tags found
No related merge requests found
......@@ -558,14 +558,18 @@ class MailFetcher {
&& ($attachments = $this->getAttachments($struct))) {
foreach ($attachments as $i=>$info) {
if (0 === strcasecmp('application/ms-tnef', $info['type'])) {
$data = $this->decode(imap_fetchbody($self->mbox,
$mid, $info['index']), $info['encoding']);
$tnef = new TnefStreamParser($data);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($attachments[$i]);
// There should only be one of these
break;
try {
$data = $this->decode(imap_fetchbody($this->mbox,
$mid, $info['index']), $info['encoding']);
$tnef = new TnefStreamParser($data);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($attachments[$i]);
// There should only be one of these
break;
} catch (TnefException $ex) {
// Noop -- winmail.dat remains an attachment
}
}
}
}
......@@ -627,7 +631,7 @@ class MailFetcher {
if(!$ost->isFileTypeAllowed($file)) {
$file['error'] = 'Invalid file type (ext) for '.Format::htmlchars($file['name']);
}
else {
elseif (!$file['data']) {
// only fetch the body if necessary
$self = $this;
$file['data'] = function() use ($self, $mid, $a) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment