aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index ee36243844..73147a85a0 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -161,6 +161,13 @@ class upload extends \phpbb\avatar\driver\driver
return false;
}
+ // Delete current avatar if not overwritten
+ $ext = substr(strrchr($row['avatar'], '.'), 1);
+ if ($ext && $ext !== $file->get('extension'))
+ {
+ $this->delete($row);
+ }
+
return array(
'avatar' => $row['id'] . '_' . time() . '.' . $file->get('extension'),
'avatar_width' => $file->get('width'),