handle 413
This commit is contained in:
@@ -246,6 +246,15 @@ def create_app():
|
|||||||
else:
|
else:
|
||||||
return render_template('common/404.html'), e.code
|
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
|
# this only happens at build time but
|
||||||
# build time is when updates are done anyway
|
# build time is when updates are done anyway
|
||||||
# sooo... /shrug
|
# sooo... /shrug
|
||||||
|
|||||||
8
app/templates/common/413.html
Normal file
8
app/templates/common/413.html
Normal 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 %}
|
||||||
Reference in New Issue
Block a user