mirror of https://github.com/status-im/codimd.git
refactor: fix lint warning on lib/letter-avatars.js
Signed-off-by: BoHong Li <a60814billy@gmail.com>
This commit is contained in:
parent
f2c8c11ea4
commit
79c6a77d18
|
@ -30,14 +30,14 @@ exports.generateAvatarURL = function (name, email = '', big = true) {
|
||||||
if (typeof email !== 'string') {
|
if (typeof email !== 'string') {
|
||||||
email = '' + name + '@example.com'
|
email = '' + name + '@example.com'
|
||||||
}
|
}
|
||||||
name=encodeURIComponent(name)
|
name = encodeURIComponent(name)
|
||||||
|
|
||||||
let hash = crypto.createHash('md5')
|
let hash = crypto.createHash('md5')
|
||||||
hash.update(email.toLowerCase())
|
hash.update(email.toLowerCase())
|
||||||
let hexDigest = hash.digest('hex')
|
let hexDigest = hash.digest('hex')
|
||||||
|
|
||||||
if (email !== '' && config.allowGravatar) {
|
if (email !== '' && config.allowGravatar) {
|
||||||
photo = 'https://www.gravatar.com/avatar/' + hexDigest;
|
photo = 'https://www.gravatar.com/avatar/' + hexDigest
|
||||||
if (big) {
|
if (big) {
|
||||||
photo += '?s=400'
|
photo += '?s=400'
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue