Attachment does not need to exist to be deleted
This commit is contained in:
parent
0ac87d1b01
commit
edb14d5ad7
|
@ -209,14 +209,9 @@ public function getComponentByRef(string $ref, ?string $filter, ?array $options
|
|||
*/
|
||||
public function deleteAttachment(string $ref)
|
||||
{
|
||||
$path = $this->getAttachmentFullPath($ref);
|
||||
$parent = dirname($path);
|
||||
$path = sprintf('%s%s/%s/%s', $this->bundle->getDataDir(), $this->attachmentsDir, $this->kind, $ref);
|
||||
|
||||
$this->disk->delete($path);
|
||||
|
||||
if (empty($this->disk->listContents($parent, true))) {
|
||||
$this->disk->delete($parent);
|
||||
}
|
||||
$this->disk->deleteDirectory($path);
|
||||
|
||||
$this->manager->remove([
|
||||
sprintf('files.%s', $ref),
|
||||
|
|
Loading…
Reference in New Issue
Block a user