From db7fd298a1ba8070d600c3273e47616f18d1128a Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 11 Apr 2024 11:52:51 +0200 Subject: [PATCH] do NOT give a 500 with "Error storing ...", for empty content/body --- mail/src/ApiHandler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mail/src/ApiHandler.php b/mail/src/ApiHandler.php index a8d02885c4..ae283ca15c 100644 --- a/mail/src/ApiHandler.php +++ b/mail/src/ApiHandler.php @@ -365,11 +365,11 @@ class ApiHandler extends Api\CalDAV\Handler // save posted eml to a temp-dir $eml = tempnam($GLOBALS['egw_info']['server']['temp_dir'], 'view-eml-'); - if (!(is_resource($content) ? + if ((is_resource($content) ? stream_copy_to_stream($content, $fp = fopen($eml, 'w')) : - file_put_contents($eml, $content))) + file_put_contents($eml, $content)) === false) { - throw new \Exception('Error storing attachment'); + throw new \Exception('Error storing eml file'); } if (isset($fp)) fclose($fp);