From 9e14af9614f97012aed8411464a1c71761f19ade Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Thu, 25 Apr 2024 15:59:17 +0200 Subject: [PATCH] feat: return 404 when ID not in featured threads --- threads.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/threads.py b/threads.py index a800245..72c54d4 100755 --- a/threads.py +++ b/threads.py @@ -19,8 +19,11 @@ def home(): @threads.route('/') def thread(id): - status = fetch_thread(id) - return render_template('threads.html', threads=[status], title=title, attribution=attribution) + if id in thread_ids: + status = fetch_thread(id) + return render_template('threads.html', threads=[status], title=title, attribution=attribution) + else: + return '

Not Found

¯\_(ツ)_/¯

go home', 404 @threads.route('/api') def api(): @@ -30,6 +33,7 @@ def api(): def api_thread(id): return fetch_thread(id) + def fetch_statuses(): statuses = [] for id in thread_ids: