Manage file too big exceptions
This commit is contained in:
@@ -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.secret_key = configuration_file["secrets"]["flask_secret_key"]
|
||||||
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
|
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
|
||||||
app.config["ALLOWED_EXTENSIONS"] = ALLOWED_EXTENSIONS
|
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
|
app.config["TEMPLATES_AUTO_RELOAD"] = True
|
||||||
|
|
||||||
# Queue creation
|
# Queue creation
|
||||||
@@ -189,6 +189,9 @@ def web_print_img():
|
|||||||
"No signature found for this print, using default signature : %s", str(e)
|
"No signature found for this print, using default signature : %s", str(e)
|
||||||
)
|
)
|
||||||
sign = configuration_file["defaults"]["signature"]
|
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
|
# check if the post request has the file part
|
||||||
if "img" not in request.files:
|
if "img" not in request.files:
|
||||||
|
|||||||
Reference in New Issue
Block a user