]> source.dussan.org Git - nextcloud-server.git/commitdiff
Properly clear cached avatars
authorjld3103 <jld3103yt@gmail.com>
Tue, 9 May 2023 10:23:57 +0000 (12:23 +0200)
committerjld3103 <jld3103yt@gmail.com>
Mon, 15 May 2023 16:18:21 +0000 (18:18 +0200)
Signed-off-by: jld3103 <jld3103yt@gmail.com>
lib/private/Avatar/AvatarManager.php

index 5c4f04de6d6106856427152e430f996aa49eaf6b..4125c8eb0a85236b8d0e4967ccaa7a772220b90a 100644 (file)
@@ -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();
                }
        }