From f2e3225da63f1d0d475fe20a0d9be0c3c03b84b3 Mon Sep 17 00:00:00 2001
From: Bastian Kuhn <bk@mathias-kettner.de>
Date: Wed, 11 Jul 2012 17:48:12 +0200
Subject: [PATCH] Fixed attachment handling

---
 api/pipe.php                | 2 +-
 include/class.mailfetch.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/api/pipe.php b/api/pipe.php
index aefc9d6c6..a35d2af20 100644
--- a/api/pipe.php
+++ b/api/pipe.php
@@ -123,7 +123,7 @@ if($cfg->allowEmailAttachments()) {
         //print_r($attachments);
         foreach($attachments as $k=>$attachment){
             if($attachment['filename'] && $cfg->canUploadFileType($attachment['filename'])) {
-                $ticket->saveAttachment($attachment['filename'],$attachment['body'],$msgid,'M');
+                $ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']),$msgid,'M');
             }
         }
     }
diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index cae8eb140..248a6ba81 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -330,7 +330,7 @@ class MailFetcher {
             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');
+                $ticket->saveAttachment(array('name'=>$filename, 'data'=>$data),$ticket->getLastMsgId(),'M');
                 return;
             }
             //TODO: Log failure??
-- 
GitLab