Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bast0006 opened this issue Sep 5, 2020 · 2 comments
Open

Comments

@bast0006
Copy link

bast0006 commented Sep 5, 2020

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.

@wolfier74
Copy link

Hi, please add this 👍

@bast0006
Copy link
Author

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

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

No branches or pull requests

2 participants