Bugfix
I implemented the following bugfix in include/class.mailfetch.php. It seems to solve the described issues.
This is a simple "paste" bugfix. I think perhaps this code could still be improved, e.g. by rewriting this function.
I did not check about if it is already fixed in the 1.7 pre-release.
function saveAttachments($ticket,$mid,$part,$index=0) {
global $cfg;
if($part && $part->ifdparameters && ($filename=$part->dparameters->value)){ //attachment
// BUGFIX START
foreach($part->dparameters as $dparam)
{
if(strtolower($dparam->attribute) == 'filename')
{
$filename = $dparam->value;
}
}
// BUGFIX END
$index=$index?$index;
if($ticket && $cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
//extract the attachments...and do the magic.
$data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$index));
$ticket->saveAttachment($filename,$data,$ticket->getLastMsgId(),'M');
return;
}
//TODO: Log failure??
}
//Recursive attachment search!
if($part && $part->parts) {
foreach($part->parts as $k=>$struct) {
if($index) $prefix = $index.'.';
$this->saveAttachments($ticket,$mid,$struct,$prefix.($k+1));
}
}
}