A bug was reported by kkurdupov in Discourse versions v2.4.5, v2.5.0, and 2.6 beta, where editing a post containing video/audio uploads triggers excessive upload requests with every keystroke. This behavior causes API rate limiting and potential auto-signouts. The issue stems from line 152 in upload-short-url.js, which re-calls the video/audio DOM element’s load function on every preview render. simon noted that disabling cache in Chrome’s dev tools could reproduce the issue, but kkurdupov clarified that cache settings shouldn’t affect request frequency — the root cause is DOM recreation during preview rendering. martin confirmed partial reproduction and found the problematic line was no longer necessary, as video previews function correctly without it. He submitted and merged a fix to remove the line, resolving the spammy upload requests. The fix was acknowledged with thanks to kkurdupov for the detailed report.
That is odd. I can only reproduce the issue if I select the “Disable cache” checkbox on my web inspector’s Network tab. When I deselect “Disable cache” I get the expected results. I’m using Chrome on Ubuntu. From your video, you don’t seem to have “Disable cache” selected, so I’m not sure what is causing the difference.
“Disable cache” must not affect on sending requests. It affects on where a result of a request comes from - from browser’s cache or from real source.
Those upload requests are sent by the code that re-renders preview every keystroke which causes to create new video/audio DOM element. So load is called for a new DOM element what definitely must send a request.
Even if it would be a “cached”(not every time newly created) DOM element then it sent a request only one time regardless of “Disable cache”.
I took a look at this and I can somewhat reproduce it with secure and non-secure video uploads. At a certain point it seems to cache and stop spamming these requests but it is still a problem. The line you pointed out:
Was added by me, but it doesn’t actually seem to affect anything now. If I remove it the video previews still work fine. I know we have done other work with video thumbnails etc. which have probably fixed whatever issue I put this line here for. So I think I will just remove this which resolves the multiple request issue.