From 4577aa5e16b98f41b04a09db890eff809c0b5926 Mon Sep 17 00:00:00 2001 From: Junior Date: Fri, 11 Oct 2024 12:08:44 -0400 Subject: [PATCH] Check comic archive contents for files without extensions to prevent parsing error --- ajax/showcomic.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ajax/showcomic.php b/ajax/showcomic.php index 184d43e..76fe076 100644 --- a/ajax/showcomic.php +++ b/ajax/showcomic.php @@ -45,6 +45,7 @@ if ( $ext == "cbz" ) { for ( $i=0; $i<$zip->numFiles; $i++ ) { $imgname = basename($zip->getNameIndex($i)); //$myext = substr($imgname, -3); + if ( ! isset(pathinfo($imgname)['extension']) ) continue; $myext = strtolower(pathinfo($imgname)['extension']); if ( ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) { $imgname = str_replace("#", "", $imgname); @@ -60,6 +61,7 @@ if ( $ext == "cbz" ) { $myfile = $comicoutputfull . $file; $mynewfile = $comicoutputfull . str_replace("#", "", $file); //$myext = strtolower(substr($file, -3)); + if ( ! isset(pathinfo($myfile)['extension']) ) continue; $myext = strtolower(pathinfo($myfile)['extension']); if ( ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) { rename($myfile, $mynewfile);