We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9720f90 commit 011f128Copy full SHA for 011f128
models/user.go
@@ -299,7 +299,9 @@ func (u *User) generateRandomAvatar(e Engine) error {
299
}
300
// NOTICE for random avatar, it still uses id as avatar name, but custom avatar use md5
301
// since random image is not a user's photo, there is no security for enumable
302
- u.Avatar = fmt.Sprintf("%d", u.ID)
+ if u.Avatar == "" {
303
+ u.Avatar = fmt.Sprintf("%d", u.ID)
304
+ }
305
if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil {
306
return fmt.Errorf("MkdirAll: %v", err)
307
0 commit comments