aboutsummaryrefslogtreecommitdiffstats
path: root/models/user_avatar.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-16 23:22:25 +0100
committerGitHub <noreply@github.com>2021-04-17 00:22:25 +0200
commit324cff68c97d766a04464488a73ccf7ad54931d9 (patch)
treec3c61ca17ca01d7002702c4765a602e76579c5ff /models/user_avatar.go
parentc29620c05ffb5ec7bda7ddde97aa7c893397081f (diff)
downloadgitea-324cff68c97d766a04464488a73ccf7ad54931d9.tar.gz
gitea-324cff68c97d766a04464488a73ccf7ad54931d9.zip
Send size to /avatars if requested (#15459)
If an avatar is requested in a particular size ensure that /avatars also gets the size request Fix #15453 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/user_avatar.go')
-rw-r--r--models/user_avatar.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/user_avatar.go b/models/user_avatar.go
index 871e176599..d336684a27 100644
--- a/models/user_avatar.go
+++ b/models/user_avatar.go
@@ -82,6 +82,9 @@ func (u *User) RealSizedAvatarLink(size int) string {
if u.Avatar == "" {
return DefaultAvatarLink()
}
+ if size > 0 {
+ return setting.AppSubURL + "/avatars/" + u.Avatar + "?size=" + strconv.Itoa(size)
+ }
return setting.AppSubURL + "/avatars/" + u.Avatar
case setting.DisableGravatar, setting.OfflineMode:
if u.Avatar == "" {
@@ -89,7 +92,9 @@ func (u *User) RealSizedAvatarLink(size int) string {
log.Error("GenerateRandomAvatar: %v", err)
}
}
-
+ if size > 0 {
+ return setting.AppSubURL + "/avatars/" + u.Avatar + "?size=" + strconv.Itoa(size)
+ }
return setting.AppSubURL + "/avatars/" + u.Avatar
}
return SizedAvatarLink(u.AvatarEmail, size)