This commit is contained in:
James Cole 2018-05-26 08:04:50 +02:00
parent b8bc8e2c47
commit 9b6766d3b2
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -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;