From: Tim Düsterhus Date: Mon, 20 Apr 2015 12:28:56 +0000 (+0200) Subject: Fix deletion of temporary files in UserAvatarAction::fetchRemoteAvatar() X-Git-Tag: 2.1.4~37^2~2^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c7db484cde900fbc43165ab6dbc519ee8eb28883;p=GitHub%2FWoltLab%2FWCF.git Fix deletion of temporary files in UserAvatarAction::fetchRemoteAvatar() --- diff --git a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php index 4e04324f98..a36e8c9ae7 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php @@ -188,7 +188,9 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { // rescale avatar if required try { - $filename = $this->enforceDimensions($filename); + $newFilename = $this->enforceDimensions($filename); + @unlink($filename); + $filename = $newFilename; } catch (\Exception $e) { /* ignore errors */ } @@ -226,6 +228,8 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { $avatarID = $avatar->avatarID; } else { + @unlink($filename); + // moving failed; delete avatar $editor = new UserAvatarEditor($avatar); $editor->delete();