From 44ad0d3a859dcbe49be0f3ef8454b688af1b2c7f Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Sat, 20 Jun 2020 14:22:48 +0100 Subject: [PATCH] [AVATAR] Try to delete tmp avatar if something goes wrong during the process --- actions/avatarsettings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 4c94d192a6..4279a3c99f 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -112,6 +112,11 @@ class AvatarsettingsAction extends SettingsAction public function showUploadForm() { + // If we detect that the user didn't finish setting a new avatar, remove the temporary file. + if (isset($_SESSION['FILEDATA'])) { + @unlink($_SESSION['FILEDATA']['filepath']); + unset($_SESSION['FILEDATA']); + } $this->elementStart('form', ['enctype' => 'multipart/form-data', 'method' => 'post', 'id' => 'form_settings_avatar',