summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSheogorath2018-07-27 13:29:08 +0200
committerSheogorath2018-07-27 13:36:22 +0200
commit187401a8762371380483db26f4bd65537ae6f66c (patch)
treeec57e608b521743bea333d2201472a2d6c4dfb60 /lib
parent23bd1a18bb65dc49c55f755b02c9083ecdff1344 (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/letter-avatars.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/letter-avatars.js b/lib/letter-avatars.js
index 53fa011a..55cf9c3a 100644
--- a/lib/letter-avatars.js
+++ b/lib/letter-avatars.js
@@ -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) {