From 79d0942780269ffe423ab1333453ab3e940de0a2 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 13 Feb 2026 09:03:05 +0100 Subject: [PATCH] fix: use DelPrefix in upload avatar FlushCache to clear all cached sizes FlushCache was using keyvalue.Del with the base key (avatar_upload_{userID}) but the actual cache entries are stored with size suffixes (avatar_upload_{userID}_{size}). The Del call targeted a key that never existed, so cached avatars were never invalidated. Switch to keyvalue.DelPrefix to delete all size variants at once, matching the pattern the gravatar provider already uses correctly. --- pkg/modules/avatar/upload/upload.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/modules/avatar/upload/upload.go b/pkg/modules/avatar/upload/upload.go index 81de8f25b..0375011e9 100644 --- a/pkg/modules/avatar/upload/upload.go +++ b/pkg/modules/avatar/upload/upload.go @@ -42,7 +42,7 @@ const CacheKeyPrefix = "avatar_upload_" // FlushCache removes cached avatars for a user func (p *Provider) FlushCache(u *user.User) error { - return keyvalue.Del(CacheKeyPrefix + strconv.Itoa(int(u.ID))) + return keyvalue.DelPrefix(CacheKeyPrefix + strconv.Itoa(int(u.ID)) + "_") } // CachedAvatar represents a cached avatar with its content and mime type