Skip to content

Firefly III: a personal finances manager

Fix #1416

James Cole9b6766d3b223
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;