From c7db484cde900fbc43165ab6dbc519ee8eb28883 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 20 Apr 2015 14:28:56 +0200 Subject: [PATCH] Fix deletion of temporary files in UserAvatarAction::fetchRemoteAvatar() --- .../files/lib/data/user/avatar/UserAvatarAction.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); -- 2.20.1