From 03fe70f63730c9d9a75c7383ee1f081b65b2d981 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Fri, 24 Nov 2017 19:23:39 +0100 Subject: [PATCH] chg: return relative redirects --- motion.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/motion.py b/motion.py index cef02ee..957bf96 100644 --- a/motion.py +++ b/motion.py @@ -106,6 +106,11 @@ def main(): return render_template('index.html', motions=rv[:10], more=rv[10]["id"] if len(rv) == 11 else None, times=times, prev=prev, categories=get_allowed_cats("create")) +def rel_redirect(loc): + r = redirect(loc) + r.autocorrect_location_header = False + return r + @app.route("/motion", methods=['POST']) def put_motion(): cat=request.form.get("category", "") @@ -116,10 +121,10 @@ def put_motion(): return "Error, invalid length", 500 p = get_db().prepare("INSERT INTO motion(\"name\", \"content\", \"deadline\", \"posed_by\", \"type\") VALUES($1, $2, CURRENT_TIMESTAMP + $3 * interval '1 days', $4, $5)") p(request.form.get("title", ""), request.form.get("content",""), time, g.voter, cat) - return redirect("/") + return rel_redirect("/") def motion_edited(motion): - return redirect("/?start=" + str(motion) + "#motion-" + str(motion)) + return rel_redirect("/?start=" + str(motion) + "#motion-" + str(motion)) @app.route("/motion//cancel", methods=['POST']) def cancel_motion(motion): -- 2.39.2