|
|
@ -299,7 +299,9 @@ func (u *User) generateRandomAvatar(e Engine) error { |
|
|
|
} |
|
|
|
} |
|
|
|
// NOTICE for random avatar, it still uses id as avatar name, but custom avatar use md5
|
|
|
|
// NOTICE for random avatar, it still uses id as avatar name, but custom avatar use md5
|
|
|
|
// since random image is not a user's photo, there is no security for enumable
|
|
|
|
// since random image is not a user's photo, there is no security for enumable
|
|
|
|
|
|
|
|
if u.Avatar == "" { |
|
|
|
u.Avatar = fmt.Sprintf("%d", u.ID) |
|
|
|
u.Avatar = fmt.Sprintf("%d", u.ID) |
|
|
|
|
|
|
|
} |
|
|
|
if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil { |
|
|
|
if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil { |
|
|
|
return fmt.Errorf("MkdirAll: %v", err) |
|
|
|
return fmt.Errorf("MkdirAll: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|