Fix names with spaces in letter-avatars

Seems like there is a possible problem when a name containing a space is
passed to this function. using urlencode on the name should fix possible
problems here.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2019-03-03 14:55:14 +01:00
parent 112827423a
commit 1ee9874393
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD
2 changed files with 42 additions and 2 deletions

View file

@ -30,6 +30,7 @@ exports.generateAvatarURL = function (name, email = '', big = true) {
if (typeof email !== 'string') {
email = '' + name + '@example.com'
}
name=encodeURIComponent(name)
let hash = crypto.createHash('md5')
hash.update(email.toLowerCase())