]> _ Git - odl.git/commitdiff
wip #5053 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 25 Jan 2022 12:32:33 +0000 (13:32 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 25 Jan 2022 12:32:39 +0000 (13:32 +0100)
app/Jobs/ProcessFluidbook.php

index 083351ef3b640c1474371b169714f8c380a5cbdc..3cc8de82d2733fe4f946caf3e47afd6501b5ebcc 100644 (file)
@@ -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)) {