From f0b0fb89097c368f046eb887662acdc85b468c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Fri, 5 Dec 2025 17:00:32 +0300 Subject: [PATCH] handle 413 --- app/__init__.py | 9 +++++++++ app/templates/common/413.html | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 app/templates/common/413.html diff --git a/app/__init__.py b/app/__init__.py index 4b54b9a..8299eab 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -246,6 +246,15 @@ def create_app(): else: return render_template('common/404.html'), e.code + @app.errorhandler(413) + def _handle_413(e): + if request.path.startswith('/hyperapi/'): + return '

request body too large

', e.code + elif request.path.startswith('/api/'): + return {'error': 'body too large'}, e.code + else: + return render_template('common/413.html'), e.code + # this only happens at build time but # build time is when updates are done anyway # sooo... /shrug diff --git a/app/templates/common/413.html b/app/templates/common/413.html new file mode 100644 index 0000000..53abcad --- /dev/null +++ b/app/templates/common/413.html @@ -0,0 +1,8 @@ +{% extends 'base.html' %} +{% block title %}not found{% endblock %} +{% block content %} +
+

413 Request Entity Too Large

+

The file(s) you tried to upload are too large.

+
+{% endblock %}