Better error messages for oversized image uploads (413 response) #2240

Closed
opened 2026-02-05 03:25:49 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @itbane on GitHub (May 11, 2021).

When uploading a file (e.g. diagrams.net diagram) that's larger then the webservers max file upload size, the upload (obviously) fails. The error message is very unprecise: "An error occurred uploading the image"

Steps To Reproduce

  1. Find out your max file upload size limit (nginx default: 1MB)
  2. Find a file (e.g. image) that's larger
  3. Try uploading the image
  4. See error

Expected behavior
The error message should tell the user the reason for failure, if possible. An example could be:
' The uploaded image was too large.'

In case of a file being too large, the HTTP response code of '413 (entity too large)' can be used to detect this kind of error.

Other reasons for failure should be accounted for as well.

Screenshots
n/a

Your Configuration (please complete the following information):

  • BookStack v21.04.3
  • PHP Version: 7.3.27-1~deb10u1
  • Hosting Method (Nginx/Apache/Docker): nginx
Originally created by @itbane on GitHub (May 11, 2021). When uploading a file (e.g. diagrams.net diagram) that's larger then the webservers max file upload size, the upload (obviously) fails. The error message is very unprecise: "An error occurred uploading the image" **Steps To Reproduce** 1. Find out your max file upload size limit (nginx default: 1MB) 2. Find a file (e.g. image) that's larger 3. Try uploading the image 4. See error **Expected behavior** The error message should tell the user the reason for failure, if possible. An example could be: ' The uploaded image was too large.' In case of a file being too large, the HTTP response code of '413 (entity too large)' can be used to detect this kind of error. Other reasons for failure should be accounted for as well. **Screenshots** n/a **Your Configuration (please complete the following information):** - BookStack v21.04.3 - PHP Version: 7.3.27-1~deb10u1 - Hosting Method (Nginx/Apache/Docker): nginx
OVERLORD added the 🛠️ Enhancement💆 UX labels 2026-02-05 03:25:49 +03:00
Author
Owner

@ssddanbrown commented on GitHub (May 26, 2021):

Thanks @itbane. I found that the normal image manager did show a relevant message in this scenario but the drawing system did not handle this as gracefully. Have now updated the drawing upload events to show the same message upon 413 response for both types of page editor. Will be part of the next feature release.

@ssddanbrown commented on GitHub (May 26, 2021): Thanks @itbane. I found that the normal image manager did show a relevant message in this scenario but the drawing system did not handle this as gracefully. Have now updated the drawing upload events to show the same message upon 413 response for both types of page editor. Will be part of the next feature release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2240