From 5a06ee50d8a3a03bf44147bda68faffeb08255e9 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 3 Nov 2016 16:19:43 +0200 Subject: [PATCH] fix notice --- application/Espo/Controllers/Attachment.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/Espo/Controllers/Attachment.php b/application/Espo/Controllers/Attachment.php index ac73a618ff..94feb87afb 100644 --- a/application/Espo/Controllers/Attachment.php +++ b/application/Espo/Controllers/Attachment.php @@ -44,8 +44,13 @@ class Attachment extends \Espo\Core\Controllers\Record throw new Forbidden(); } - list($prefix, $contents) = explode(',', $data); - $contents = base64_decode($contents); + $arr = explode(',', $data); + if (count($arr) > 1) { + list($prefix, $contents) = $arr; + $contents = base64_decode($contents); + } else { + $contents = ''; + } $attachment = $this->getEntityManager()->getEntity('Attachment'); $this->getEntityManager()->saveEntity($attachment);