From 9b6766d3b2239789d91fbea60f9e98375558457f Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 26 May 2018 08:04:50 +0200 Subject: [PATCH] Fix #1416 --- app/Repositories/Attachment/AttachmentRepository.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 23cf6e9fad..36d38ade9d 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -24,6 +24,7 @@ namespace FireflyIII\Repositories\Attachment; use Carbon\Carbon; use Crypt; +use Exception; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Models\Attachment; use FireflyIII\Models\Note; @@ -52,7 +53,11 @@ class AttachmentRepository implements AttachmentRepositoryInterface $helper = app(AttachmentHelperInterface::class); $file = $helper->getAttachmentLocation($attachment); - unlink($file); + try { + unlink($file); + } catch (Exception $e) { + Log::error(sprintf('Could not delete file for attachment %d.', $attachment->id)); + } $attachment->delete(); return true;