diff options
Diffstat (limited to 'modules/templates/util_avatar.go')
-rw-r--r-- | modules/templates/util_avatar.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/templates/util_avatar.go b/modules/templates/util_avatar.go index f7dd408ee2..470e24fa61 100644 --- a/modules/templates/util_avatar.go +++ b/modules/templates/util_avatar.go @@ -34,7 +34,8 @@ func AvatarHTML(src string, size int, class, name string) template.HTML { name = "avatar" } - return template.HTML(`<img loading="lazy" class="` + class + `" src="` + src + `" title="` + html.EscapeString(name) + `" width="` + sizeStr + `" height="` + sizeStr + `"/>`) + // use empty alt, otherwise if the image fails to load, the width will follow the "alt" text's width + return template.HTML(`<img loading="lazy" alt="" class="` + class + `" src="` + src + `" title="` + html.EscapeString(name) + `" width="` + sizeStr + `" height="` + sizeStr + `"/>`) } // Avatar renders user avatars. args: user, size (int), class (string) |