From 3f55e197ea0842ed7e3cbf8f2eeb8381993bc06b Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 29 Jun 2023 16:34:23 +0200 Subject: [PATCH] wait #6095 @0.75 --- src/Links/SlideshowLink.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Links/SlideshowLink.php b/src/Links/SlideshowLink.php index 78e42f1..737ff3c 100644 --- a/src/Links/SlideshowLink.php +++ b/src/Links/SlideshowLink.php @@ -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'; -- 2.39.5