Skip to content

Commit

Permalink
Fix possible weird objects as email
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
SISheogorath committed Jul 27, 2018
1 parent 23bd1a1 commit 187401a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/letter-avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ exports.generateAvatar = function (name) {

exports.generateAvatarURL = function (name, email = '', big = true) {
let photo
if (typeof email !== 'string') {
email = '' + name + '@example.com'
}

if (email !== '' && config.allowGravatar) {
photo = 'https://www.gravatar.com/avatar/' + md5(email.toLowerCase())
if (big) {
Expand Down

0 comments on commit 187401a

Please sign in to comment.