mirror of https://github.com/status-im/codimd.git
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:
parent
23bd1a18bb
commit
187401a876
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue