mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-28 10:28:33 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user