]> _ Git - fluidbook_tools.git/commitdiff
wait #6095 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 29 Jun 2023 14:34:23 +0000 (16:34 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 29 Jun 2023 14:34:23 +0000 (16:34 +0200)
src/Links/SlideshowLink.php

index 78e42f1b4740a150902b03bcdd619b0190165e56..737ff3c6f2b2fb3b96c0b9dfdd35e6072d2ccda2 100644 (file)
@@ -5,6 +5,7 @@ namespace Fluidbook\Tools\Links;
 use Cubist\Util\Files\Files;
 use Cubist\Util\Graphics\Image;
 use Cubist\Util\Xml;
+use Illuminate\Support\Facades\Log;
 
 class SlideshowLink extends NormalLink {
 
@@ -43,6 +44,9 @@ class SlideshowLink extends NormalLink {
         return 'view slideshow';
     }
 
+    /**
+     * @throws \Exception
+     */
     public function generateSlideshow($context) {
         $this->compiler->addSlideshowLibrary($context === 'inline');
 
@@ -63,7 +67,12 @@ class SlideshowLink extends NormalLink {
         $slides_options = [];
 
         // If the zip file contained a slideshow.xml file, use that for fetching images and their captions
-        if (file_exists($XML_path) && $slideshow_XML = simplexml_load_string(file_get_contents($XML_path))) {
+        if (file_exists($XML_path)) {
+            try {
+                $slideshow_XML = simplexml_load_file($XML_path);
+            } catch (\Exception $e) {
+                throw new \Exception('Error while decoding xml file of slideshow ' . $this->to . ' on page ' . $this->page . ' : ' . $e->getMessage());
+            }
             $slideshowData = Xml::toObject($slideshow_XML);
             $thumbnails = isset($slideshowData->_thumbnails) && $slideshowData->_thumbnails !== 'false';