Merge branch '5.3'
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 1 Dec 2020 13:45:23 +0000 (14:45 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 1 Dec 2020 13:45:23 +0000 (14:45 +0100)
1  2 
wcfsetup/install/files/lib/data/style/StyleAction.class.php
wcfsetup/install/lang/en.xml

index 704f40d1078322d0d216715d7fa343f17b4ffa9c,c0f4aa528453294783254588cfcc6c6e6d57b67e..9a62d7be91fdc0cd940c6c31f9fed35825e309a2
@@@ -185,16 -184,11 +185,11 @@@ class StyleAction extends AbstractDatab
                                /** @var \wcf\system\file\upload\UploadFile $file */
                                $file = $this->parameters['uploads'][$type];
                                
-                               if ($style->getVariable($type) && file_exists($style->getAssetPath().basename($style->getVariable($type)))) {
-                                       if (!$file || $style->getAssetPath().basename($style->getVariable($type)) !== $file->getLocation()) {
-                                               unlink($style->getAssetPath().basename($style->getVariable($type)));
-                                       }
-                               }
-                               
-                               if ($file !== null) {
+                               // Only save file, if it is not proccessed. 
+                               if ($file !== null && !$file->isProcessed()) {
                                        $fileLocation = $file->getLocation();
                                        $extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
 -                                      $newName = $type.'-'.\bin2hex(\random_bytes(4)).'.'.$extension;
 +                                      $newName = $type.'-'.Hex::encode(\random_bytes(4)).'.'.$extension;
                                        $newLocation = $style->getAssetPath().$newName;
                                        rename($fileLocation, $newLocation);
                                        $this->parameters['variables'][$type] = $newName;
Simple merge