Skip to content

Commit 187401a

Browse files
committed
Fix possible weird objects as email
It seems like some providers return strange types for emails which cause problems. We default to something that is definitely a string. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent 23bd1a1 commit 187401a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/letter-avatars.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ exports.generateAvatar = function (name) {
2727

2828
exports.generateAvatarURL = function (name, email = '', big = true) {
2929
let photo
30+
if (typeof email !== 'string') {
31+
email = '' + name + '@example.com'
32+
}
33+
3034
if (email !== '' && config.allowGravatar) {
3135
photo = 'https://www.gravatar.com/avatar/' + md5(email.toLowerCase())
3236
if (big) {

0 commit comments

Comments
 (0)