From 6990effaf7e1a32db51b7a713f42a556cdde1398 Mon Sep 17 00:00:00 2001 From: TheAMM Date: Sat, 13 May 2017 03:15:34 +0300 Subject: [PATCH] [upload] Send 400 if POSTed at with a bad form --- nyaa/routes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nyaa/routes.py b/nyaa/routes.py index 1a2564a..b01a80a 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -613,7 +613,9 @@ def upload(): return flask.redirect('/view/' + str(torrent.id)) else: - return flask.render_template('upload.html', form=form, user=flask.g.user) + # If we get here with a POST, it means the form data was invalid: return a non-okay status + status_code = 400 if flask.request.method == 'POST' else 200 + return flask.render_template('upload.html', form=form, user=flask.g.user), status_code @app.route('/view/')