From af15ed875457f3dc979665275e54e2a55598e098 Mon Sep 17 00:00:00 2001 From: n07070 Date: Thu, 4 Jun 2026 19:45:37 +0200 Subject: [PATCH] Manage file too big exceptions --- src/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index acc4b93..ccd4efd 100644 --- a/src/main.py +++ b/src/main.py @@ -90,7 +90,7 @@ if not os.getenv("FLASK_DEBUG") is None and os.getenv("FLASK_DEBUG") is True: app.secret_key = configuration_file["secrets"]["flask_secret_key"] app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER app.config["ALLOWED_EXTENSIONS"] = ALLOWED_EXTENSIONS -app.config["MAX_CONTENT_LENGTH"] = 10 * 1000 * 1000 # Maximum 3Mb for a file upload +app.config["MAX_CONTENT_LENGTH"] = 10 * 1000 * 1000 # Maximum 10Mb for a file upload app.config["TEMPLATES_AUTO_RELOAD"] = True # Queue creation @@ -189,6 +189,9 @@ def web_print_img(): "No signature found for this print, using default signature : %s", str(e) ) sign = configuration_file["defaults"]["signature"] + except werkzeug.exceptions.RequestEntityTooLarge as e: + flash("Whoops, image is too big: " + str(e), "error") + return redirect(url_for("index")) # check if the post request has the file part if "img" not in request.files: