handle 413

This commit is contained in:
2025-12-05 17:00:32 +03:00
parent 9ae4e376b8
commit f0b0fb8909
2 changed files with 17 additions and 0 deletions

View File

@@ -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 '<h1>request body too large</h1>', 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

View File

@@ -0,0 +1,8 @@
{% extends 'base.html' %}
{% block title %}not found{% endblock %}
{% block content %}
<div class="darkbg settings-container">
<h1 class="thread-title">413 Request Entity Too Large</h1>
<p>The file(s) you tried to upload are too large.</p>
</div>
{% endblock %}