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.
This commit is contained in:
kolaente
2026-02-13 09:03:05 +01:00
parent c93fa1b4ae
commit 79d0942780

View File

@@ -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