ensure trailing slashes in all routes

This commit is contained in:
2026-04-17 10:45:54 +03:00
parent 9d8404b774
commit d2cdeaed1d
5 changed files with 19 additions and 19 deletions

View File

@@ -5,7 +5,7 @@ import math
bp = Blueprint('threads', __name__, url_prefix='/threads/')
@bp.get('/<slug>')
@bp.get('/<slug>/')
def thread(slug):
thread = Threads.find({'slug': slug})
if not thread:
@@ -34,7 +34,7 @@ def thread(slug):
abort(404)
return render_template('threads/thread.html', thread=thread, posts=thread.get_posts(PER_PAGE, page), page=page, page_count=page_count, topic=topic, started_by=started_by, topics=Topics.get_list(), Reactions=Reactions)
@bp.post('/<slug>/reply')
@bp.post('/<slug>/reply/')
@login_required
def reply(slug):
user = get_active_user()
@@ -47,7 +47,7 @@ def reply(slug):
post = Posts.new(user.id, thread.id, request.form.get('babycode_content'))
return redirect(url_for('.thread', slug=slug, after=post.id, _anchor=f'post-{post.id}'))
@bp.get('/<slug>/feed.atom')
@bp.get('/<slug>/feed.atom/')
def feed(slug):
return 'stub'
@@ -61,7 +61,7 @@ def new():
selected_topic = None
return render_template('threads/new_thread.html', topics=topics, selected_topic=selected_topic)
@bp.post('/new')
@bp.post('/new/')
@login_required
def new_post():
try: