-
Notifications
You must be signed in to change notification settings - Fork 131
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
Uploading too large of an image as an avatar shouldn't redirect to a 413 "Request Entity Too Large" page #3100
Comments
Currently any upload requests over The application actually already rejects any images over 1MB in size and displays an error message (see image below) provided Nginx is configured to allow them. The simplest solution would be to increase the In this case users will still see the Nginx error page if their image exceeds the If that sounds like an acceptable solution I can work on a PR to update the Nginx config setup in Ansible for TatoVM, but I assume an admin will have to update the configuration on the official deployment. |
I would prefer that solution. It's future-proof (no need to bump the limit as camera resolution and images sizes increase), saves users' bandwidth from uselessly uploading a file only to have it rejected, and also prevents our server from using too much memory to handle a request. I found a StackOverflow question with answers suggesting that checking the file size client-side in JavaScript was already supported 13 years ago, though the particulars might be outdated by now. An alternative solution that came to mind is to replace the 413 error page by something custom that explains more clearly what's going on. |
That's a good point, I hadn't really thought that far ahead. Client-side verification is probably the way to go then for a more permanent solution.
I was also considering that, but, correct me if I'm wrong, I think you'd have to configure Nginx to serve a static error page instead of going through the application which would be okay I guess. Just a bit strange and hard to find since it wouldn't go through the rest of the application routing. Either way, I'll look into adding some client-side verification with the File API. |
I tried uploading a new avatar for my profile, which was a 5 MB image file, which threw me out onto this page:
I would propose that instead of this, Tatoeba wouldn't allow files that are larger than a predefined size limit, and if that limit is crossed, would show a simple dialog or error message telling the user the file they tried to upload is too large.
The text was updated successfully, but these errors were encountered: