aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCodruț Constantin Gușoi <codrut.gusoi@gmail.com>2018-02-08 15:43:08 +0000
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2018-02-08 16:43:08 +0100
commit011f128c892e86e753a8ac8d94d73e4676648db2 (patch)
tree0707e836223c12f2173e757b8dde7a73b8e3d953
parent9720f90905b20e18e6ca9c7715121533f7734d47 (diff)
downloadgitea-011f128c892e86e753a8ac8d94d73e4676648db2.tar.gz
gitea-011f128c892e86e753a8ac8d94d73e4676648db2.zip
Fixes missing avatars in offline mode (#3471)
Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
-rw-r--r--models/user.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/models/user.go b/models/user.go
index ecfe3bca0f..57abfc1965 100644
--- a/models/user.go
+++ b/models/user.go
@@ -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
// since random image is not a user's photo, there is no security for enumable
- u.Avatar = fmt.Sprintf("%d", u.ID)
+ if u.Avatar == "" {
+ u.Avatar = fmt.Sprintf("%d", u.ID)
+ }
if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil {
return fmt.Errorf("MkdirAll: %v", err)
}