From f57dfd87616dc941336e6f666f4606457c2e3b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Wed, 13 May 2020 17:37:20 +0200 Subject: [PATCH] Message: createAttachment: Use FileSystem::read() instead of native file_get_contents(). --- src/Mail/Message.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Mail/Message.php b/src/Mail/Message.php index e763f591..fc1f21cb 100644 --- a/src/Mail/Message.php +++ b/src/Mail/Message.php @@ -297,10 +297,7 @@ private function createAttachment(string $file, string $content = null, string $ { $part = new MimePart; if ($content === null) { - $content = @file_get_contents($file); // @ is escalated to exception - if ($content === false) { - throw new Nette\FileNotFoundException("Unable to read file '$file'."); - } + $content = Nette\Utils\FileSystem::read($file); } if (!$contentType) { $contentType = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content);