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>
This commit is contained in:
Sheogorath 2018-07-27 13:29:08 +02:00
parent 23bd1a18bb
commit 187401a876
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD

View file

@ -27,6 +27,10 @@ exports.generateAvatar = function (name) {
exports.generateAvatarURL = function (name, email = '', big = true) { exports.generateAvatarURL = function (name, email = '', big = true) {
let photo let photo
if (typeof email !== 'string') {
email = '' + name + '@example.com'
}
if (email !== '' && config.allowGravatar) { if (email !== '' && config.allowGravatar) {
photo = 'https://www.gravatar.com/avatar/' + md5(email.toLowerCase()) photo = 'https://www.gravatar.com/avatar/' + md5(email.toLowerCase())
if (big) { if (big) {