mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Auto commit for release 'develop' on 2025-03-14
This commit is contained in:
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Repositories\Attachment;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\AttachmentFactory;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
@@ -36,7 +35,6 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use League\Flysystem\UnableToDeleteFile;
|
||||
use LogicException;
|
||||
|
||||
/**
|
||||
* Class AttachmentRepository.
|
||||
@@ -46,14 +44,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn
|
||||
use UserGroupTrait;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(Attachment $attachment): bool
|
||||
{
|
||||
/** @var AttachmentHelperInterface $helper */
|
||||
$helper = app(AttachmentHelperInterface::class);
|
||||
|
||||
$path = $helper->getAttachmentLocation($attachment);
|
||||
$path = $helper->getAttachmentLocation($attachment);
|
||||
|
||||
try {
|
||||
Storage::disk('upload')->delete($path);
|
||||
@@ -120,7 +118,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn
|
||||
/** @var AttachmentFactory $factory */
|
||||
$factory = app(AttachmentFactory::class);
|
||||
$factory->setUser($this->user);
|
||||
$result = $factory->create($data);
|
||||
$result = $factory->create($data);
|
||||
if (null === $result) {
|
||||
throw new FireflyException('Could not store attachment.');
|
||||
}
|
||||
@@ -160,14 +158,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (LogicException $e) {
|
||||
} catch (\LogicException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
$dbNote = $attachment->notes()->first();
|
||||
$dbNote = $attachment->notes()->first();
|
||||
if (null === $dbNote) {
|
||||
$dbNote = new Note();
|
||||
$dbNote->noteable()->associate($attachment);
|
||||
|
Reference in New Issue
Block a user