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)
|
public function deleteAttachment(string $ref)
|
||||||
{
|
{
|
||||||
$path = $this->getAttachmentFullPath($ref);
|
$path = sprintf('%s%s/%s/%s', $this->bundle->getDataDir(), $this->attachmentsDir, $this->kind, $ref);
|
||||||
$parent = dirname($path);
|
|
||||||
|
|
||||||
$this->disk->delete($path);
|
$this->disk->deleteDirectory($path);
|
||||||
|
|
||||||
if (empty($this->disk->listContents($parent, true))) {
|
|
||||||
$this->disk->delete($parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->manager->remove([
|
$this->manager->remove([
|
||||||
sprintf('files.%s', $ref),
|
sprintf('files.%s', $ref),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user