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.
This commit is contained in:
Xevion
2022-03-28 18:17:52 -05:00
parent c4b22b8632
commit 208b9ba674

View File

@@ -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)