From 66d6f99bd1c7e0630f9d836443c3284169d9d757 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 25 Jan 2022 13:32:33 +0100 Subject: [PATCH] wip #5053 @0.25 --- app/Jobs/ProcessFluidbook.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Jobs/ProcessFluidbook.php b/app/Jobs/ProcessFluidbook.php index 083351e..3cc8de8 100644 --- a/app/Jobs/ProcessFluidbook.php +++ b/app/Jobs/ProcessFluidbook.php @@ -95,7 +95,7 @@ class ProcessFluidbook extends Compiler throw new \Exception('L\'élement ' . $id . ' n\'existe pas dans la médiathèque'); } $collection = $asset->getMediaInField($asset->getAttributeValue('file_upload')); - if ((is_array($collection) && count($collection) === 0) || $collection->count() === 0) { + if ((is_array($collection) && count($collection) === 0) || $collection->count() === 0 || $asset->getFilesize() === 0) { throw new \Exception('L\'élement ' . $id . ' de la médiathèque ne contient aucun fichier'); } return $collection; @@ -114,7 +114,9 @@ class ProcessFluidbook extends Compiler $path = $item->getPath(); /** @var $item Media */ $dest = $tmp . '/' . Files::getFilename($path); - copy($path, $dest); + if (file_exists($path)) { + copy($path, $dest); + } } Zip::archive($tmp, $zip); if (!file_exists($zip)) { -- 2.39.5