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

@@ -14,27 +14,27 @@ def mod_only():
def index():
return 'stub'
@bp.get('/topics/new')
@bp.get('/topics/new/')
def new_topic():
return render_template('mod/new_topic.html')
@bp.post('/topics/new')
@bp.post('/topics/new/')
def new_topic_post():
topic = Topics.new(request.form.get('name'), request.form.get('description'))
return redirect(url_for('topics.topic', slug=topic.slug))
@bp.get('/topics/sort')
@bp.get('/topics/sort/')
def sort_topics():
return 'stub'
@bp.get('/topics/<int:topic_id>/edit')
@bp.get('/topics/<int:topic_id>/edit/')
def edit_topic(topic_id):
topic = Topics.find({'id': topic_id})
if not topic:
abort(404)
return render_template('mod/edit_topic.html', topic=topic)
@bp.post('/topics/<int:topic_id>/edit')
@bp.post('/topics/<int:topic_id>/edit/')
def edit_topic_post(topic_id):
topic = Topics.find({'id': topic_id})
if not topic:
@@ -45,7 +45,7 @@ def edit_topic_post(topic_id):
})
return redirect(url_for('topics.topic', slug=topic.slug))
@bp.post('/topics/<int:topic_id>/lock')
@bp.post('/topics/<int:topic_id>/lock/')
def lock_topic(topic_id):
topic = Topics.find({'id': topic_id})
if not topic:
@@ -53,7 +53,7 @@ def lock_topic(topic_id):
topic.update({'is_locked': request.form.get('lock', default=0)})
return redirect(url_for('topics.topic', slug=topic.slug))
@bp.post('/threads/<int:thread_id>/move')
@bp.post('/threads/<int:thread_id>/move/')
def move_thread(thread_id):
thread = Threads.find({'id': thread_id})
if not thread:
@@ -64,7 +64,7 @@ def move_thread(thread_id):
thread.update({'topic_id': target_topic.id})
return redirect(url_for('threads.thread', slug=thread.slug))
@bp.post('/threads/<int:thread_id>/lock')
@bp.post('/threads/<int:thread_id>/lock/')
def lock_thread(thread_id):
thread = Threads.find({'id': thread_id})
if not thread:
@@ -72,7 +72,7 @@ def lock_thread(thread_id):
thread.update({'is_locked': request.form.get('lock')})
return redirect(url_for('threads.thread', slug=thread.slug))
@bp.post('/threads/<int:thread_id>/sticky')
@bp.post('/threads/<int:thread_id>/sticky/')
def sticky_thread(thread_id):
thread = Threads.find({'id': thread_id})
if not thread: