Fix the handling of damaged files
authorAlexander Ebert <ebert@woltlab.com>
Fri, 2 Aug 2024 11:15:33 +0000 (13:15 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 2 Aug 2024 11:15:33 +0000 (13:15 +0200)
wcfsetup/install/files/lib/system/file/processor/FileProcessor.class.php

index 1374d829fb561baae02e3ac5b5947c11d8ab18f7..1e45efebecd568735571da37ea8a7f6619afbec6 100644 (file)
@@ -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;
                 }
             }