Gravatar: disable default avatar
jpuffer opened this issue · comments
Unavatar's fallback does not work for email, because bad email addresses trigger Gravatar's fallback and get Gravatar's default image. For example, see the result of https://unavatar.now.sh/myuser@domain.com - it is Gravatar's fallback image, not Unavatar's fallback.
The problem is Gravatar is using a default image by default:
https://github.com/Kikobeats/unavatar/blob/master/src/providers/index.js#L17
I didn't find a way to disable this behavior. Any idea?
Duplicate of #64
Hi @Kikobeats! First, awesome library.... really impressive work. Thanks for replying to this! I believe the behavior I pointed out is actually fixable by Unavatar.
See the following:
https://unavatar.now.sh/user@domain.com?fallback=https://domain.com/myimage.jpg&json
returns {"url":"https://gravatar.com/avatar/cd2bfcffe5fee4a1149d101994d0987f?size=400&d="}
but Gravatar gives the option of passing through the default image (urlencoded) into the d=
parameter (see https://en.gravatar.com/site/implement/images#default-image). The above request should instead return {"url":"https://gravatar.com/avatar/cd2bfcffe5fee4a1149d101994d0987f?size=400&d=https%3A%2F%2Fdomain.com%2Fmyimage.jpg"}
If a user does not provide a fallback parameter to unavatar, then it should create the gravatar url with d=404
so unavatar can use its own fallback. Currently, it does not set the d value (see https://unavatar.now.sh/user@domain.com?json) which returns {"url":"https://gravatar.com/avatar/cd2bfcffe5fee4a1149d101994d0987f?size=400&d="}
but should instead return {"url":"https://gravatar.com/avatar/cd2bfcffe5fee4a1149d101994d0987f?size=400&d=404"}
Oh thanks for this reply, I wanted to change the gravatar behavior for a long time!
Can you make a PR?