Img upload 404 for large images?

if you drag in a large image/photo then it shows as 404 until you refresh.

possible race condition where the imgproxy preview version isn’t available soon enough after image upload?

one mitigation would be to not use imgproxy urls for imgs uploaded in current session https://discord.com/channels/857305113936134204/857724063903252530/1484597175374708858

Bump , I think I’ve figured out a solution

Reported again in https://discord.com/channels/857305113936134204/857724063903252530/1489767420368257044

:articulated_lorry: fix shipped

long explanation of this hard to reproduce race-condition bug:

You upload an image which ends up in an s3 bucket , but images to the client are actually served to the client through a different url from a firstparty instance of imgproxy which dynamically resizes images. This normally works fine , but if the image takes too long to process because it’s too big (>1mb), then it’s not ready fast enough after the s3 upload completes. If that happens you get into a situation where the image exists but the browser shows as 404 (which makes the image appear to be deleted). Compounding this issue is that browsers can cache 404 responses so that when you reload the page, the image will still not be fetched.

The solution is too keep showing the upload preview image even after the upload is complete. Reloading the page will then swap over to loading the real url.

As a side bonus, this change improves the perceived speed of uploading because we’re no longer waiting for the real file to download after the upload is complete.

1 Like