Skip to content

Conversation

@bast0006
Copy link
Contributor

Avatar images have an onerror attribute to set their image to a generic avatar image if they fail to load from discord. However, in situations where the network fails or the discord CDN is unavailable for some reason (adblockers), this will throw an error as well.

In browsers other than chrome, this will trigger the on-error handler again, infinitely looping requests as fast as possible.

We set the onerror handler to null before making the new request to get around this and ensure if the fallback fails to load we don't make further requests.

Avatar images have an onerror attribute to set their image to a generic avatar image if they fail to load from discord. However, in situations where the network fails or the discord CDN is unavailable for some reason (adblockers), this will throw an error as well.

In browsers other than chrome, this will trigger the on-error handler again, infinitely looping requests as fast as possible. 

We set the onerror handler to null before making the new request to get around this and ensure if the fallback fails to load we don't make further requests. 

Signed-off-by: Bast <52266665+bast0006@users.noreply.github.com>
@bast0006
Copy link
Contributor Author

Fixes #20

ChrisLovering added a commit to python-discord/logviewer that referenced this pull request Aug 12, 2024
This is pulled directly from modmail-dev#82
@Taaku18 Taaku18 merged commit 33f5edd into modmail-dev:master Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants