From: Tim Düsterhus Date: Tue, 1 Dec 2020 13:45:23 +0000 (+0100) Subject: Merge branch '5.3' X-Git-Tag: 5.4.0_Alpha_1~568 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a480c62ba78c3f1271b850a799d7b8af16486c7a;p=GitHub%2FWoltLab%2FWCF.git Merge branch '5.3' --- a480c62ba78c3f1271b850a799d7b8af16486c7a diff --cc wcfsetup/install/files/lib/data/style/StyleAction.class.php index 704f40d107,c0f4aa5284..9a62d7be91 --- a/wcfsetup/install/files/lib/data/style/StyleAction.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleAction.class.php @@@ -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;