logviewer icon indicating copy to clipboard operation
logviewer copied to clipboard

Onerror handler for lazy loading images repeats with no delay or cap

Open bast0006 opened this issue 5 years ago • 2 comments

While experiencing some local network issues I discovered a potential issue with the lazy-loading feature for avatars within modmail logs.

                 onerror="this.src='{{ log_entry.recipient.default_avatar_url }}'"

Doesn't have a retry limit or retry cap, so despite the network requests failing with "ERR_NOT_REACHABLE" It continued to retry for the default avatar with millisecond delay times, counting up requests in the thousands/second, multiplied by the number of avatars present within the log.

You can reproduce the issue by blocking access to cdn.discordapp.com and loading a modmail log with the browser network panel open.

                 onerror="this.src='{{ log_entry.recipient.default_avatar_url }}';this.onerror=null"

Would reduce it to a single attempt to load the default avatar before failing and leaving the space with a broken image.

bast0006 avatar Sep 05 '20 03:09 bast0006

Hi, please add this 👍

wolfier74 avatar Nov 22 '20 07:11 wolfier74

Anyway I just hit this again except this time triggered by my adblocker, so I'll open a PR.

bast0006 avatar Aug 12 '24 05:08 bast0006