From 349247474c46603f176b28b4e35c4bf6fe9e3309 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 2 Aug 2024 13:15:33 +0200 Subject: [PATCH] Fix the handling of damaged files --- .../system/file/processor/FileProcessor.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/file/processor/FileProcessor.class.php b/wcfsetup/install/files/lib/system/file/processor/FileProcessor.class.php index 1374d829fb..1e45efebec 100644 --- a/wcfsetup/install/files/lib/system/file/processor/FileProcessor.class.php +++ b/wcfsetup/install/files/lib/system/file/processor/FileProcessor.class.php @@ -143,8 +143,12 @@ final class FileProcessor extends SingletonFactory try { $imageAdapter->loadSingleFrameFromFile($file->getPathname()); - } catch (SystemException) { + } catch (SystemException | ImageNotReadable) { throw new DamagedImage($file->fileID); + } catch (ImageNotProcessable $e) { + logThrowable($e); + + return; } $filename = FileUtil::getTemporaryFilename(extension: 'webp'); @@ -219,8 +223,12 @@ final class FileProcessor extends SingletonFactory try { $imageAdapter->loadSingleFrameFromFile($file->getPathname()); - } catch (ImageNotReadable | ImageNotProcessable $e) { + } catch (SystemException | ImageNotReadable $e) { throw new DamagedImage($file->fileID, $e); + } catch (ImageNotProcessable $e) { + logThrowable($e); + + return; } } -- 2.20.1