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 %}