From: jld3103 Date: Tue, 9 May 2023 10:23:57 +0000 (+0200) Subject: Properly clear cached avatars X-Git-Tag: v27.0.0rc1~18^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e294045223992056051659f620be5a49ece6d8e8;p=nextcloud-server.git Properly clear cached avatars Signed-off-by: jld3103 --- diff --git a/lib/private/Avatar/AvatarManager.php b/lib/private/Avatar/AvatarManager.php index 5c4f04de6d6..4125c8eb0a8 100644 --- a/lib/private/Avatar/AvatarManager.php +++ b/lib/private/Avatar/AvatarManager.php @@ -160,13 +160,8 @@ class AvatarManager implements IAvatarManager { public function clearCachedAvatars() { $users = $this->config->getUsersForUserValue('avatar', 'generated', 'true'); foreach ($users as $userId) { - try { - $folder = $this->appData->getFolder($userId); - $folder->delete(); - } catch (NotFoundException $e) { - $this->logger->debug("No cache for the user $userId. Ignoring..."); - } - $this->config->setUserValue($userId, 'avatar', 'generated', 'false'); + // This also bumps the avatar version leading to cache invalidation in browsers + $this->getAvatar($userId)->remove(); } }