From: Alexander Ebert Date: Fri, 2 Aug 2024 11:15:33 +0000 (+0200) Subject: Fix the handling of damaged files X-Git-Tag: 6.1.0_Alpha_1~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=349247474c46603f176b28b4e35c4bf6fe9e3309;p=GitHub%2FWoltLab%2FWCF.git Fix the handling of damaged files --- 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; } }