From 2dd39d24a72e9f25467a0baf5492dc150e9b6e91 Mon Sep 17 00:00:00 2001 From: Josh Richards Date: Sat, 6 Jul 2024 18:01:25 -0400 Subject: [PATCH] fix(previews): Stop returning true when getimagesize() fails Signed-off-by: Josh Richards --- lib/private/legacy/OC_Image.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index cc6968839d44f..622c1704b098b 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -569,7 +569,7 @@ private function checkImageMemory($width, $height) { private function checkImageSize($path) { $size = @getimagesize($path); if (!$size) { - return true; + return false; } $width = $size[0]; @@ -590,7 +590,7 @@ private function checkImageSize($path) { private function checkImageDataSize($data) { $size = @getimagesizefromstring($data); if (!$size) { - return true; + return false; } $width = $size[0]; @@ -637,7 +637,7 @@ public function loadFromFile($imagePath = false) { if (!$this->checkImageSize($imagePath)) { return false; } - if (getimagesize($imagePath) !== false) { + if (@getimagesize($imagePath) !== false) { $this->resource = @imagecreatefromjpeg($imagePath); } else { $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']);