Incorrect handling of GIF cover photos when rebuilding users
authorMarcel Werk <burntime@woltlab.com>
Tue, 29 Mar 2022 12:01:36 +0000 (14:01 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 29 Mar 2022 12:01:36 +0000 (14:01 +0200)
wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php

index eeb12f0d76997e9cdcf050d189cda33c21db783e..4882f0c7a283cc26b6494211032076e47897d2c6 100644 (file)
@@ -322,10 +322,17 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker
                 }
 
                 if ($coverPhoto instanceof IWebpUserCoverPhoto) {
-                    $coverPhoto->createWebpVariant();
-                    $editor->update([
-                        'coverPhotoHasWebP' => 1,
-                    ]);
+                    $result = $coverPhoto->createWebpVariant();
+                    if ($result !== null) {
+                        $data['coverPhotoHasWebP'] = 1;
+
+                        // A fallback jpeg image was just created.
+                        if ($result === false) {
+                            $data['coverPhotoExtension'] = 'jpg';
+                        }
+
+                        $editor->update($data);
+                    }
                 }
             }
         }