logviewer icon indicating copy to clipboard operation
logviewer copied to clipboard

Fix infinite onerror loop in avatar image loader

Open bast0006 opened this issue 1 year ago • 1 comments

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.

bast0006 avatar Aug 12 '24 05:08 bast0006