From 208b9ba67490a2894da10775d0d7d3683bb7360d Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 28 Mar 2022 18:17:52 -0500 Subject: [PATCH] Fix new post form length filters not redirecting correctly I never ran into this error myself, but I think if we did, it's possible it could have caused some kind of infinite loop. Or it would just error because the form is mapped to POST requests only - unless the browser would take the redirect and send the POST request there - but that wouldn't make sense given it's normal purpose. --- forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms.py b/forms.py index b53c493..b41156e 100644 --- a/forms.py +++ b/forms.py @@ -31,10 +31,10 @@ def new_post(): if len(post_text) < 15: flash('Must have at least 15 characters of text.') - return redirect(url_for('forms.new_post')) + return redirect(url_for('main.feed')) elif len(post_text) > 1000: flash('Cannot have more than 1000 characters of text.') - return redirect(url_for('forms.new_post')) + return redirect(url_for('main.feed')) post = Post(author=current_user.id, text=post_text) db.session.add(post)