Skip to content

Commit f48bca5

Browse files
Copilotmsaroufim
andcommitted
Fix 10 failing backend tests by correcting blueprint endpoint references and error handling
Co-authored-by: msaroufim <[email protected]>
1 parent 99bd704 commit f48bca5

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

kernelboard/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,14 @@ def unauthorized(_error):
125125

126126
@app.errorhandler(404)
127127
def not_found(_error):
128-
return redirect("/v2/404")
128+
# Only redirect to React frontend for v2 routes or unhandled routes
129+
# Let backend routes (like /leaderboard/123) return proper 404s
130+
from flask import request
131+
if request.path.startswith('/v2/') or request.path == '/':
132+
return redirect("/v2/404")
133+
else:
134+
# Let the backend route handle the 404 properly
135+
return _error
129136

130137
@app.errorhandler(500)
131138
def server_error(_error):

kernelboard/templates/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
<div class="header-container">
2020
<div class="header-layout">
2121
<div class="header-row">
22-
<a href="{{ url_for('index') }}" class="header-brand-item">
22+
<a href="{{ url_for('index.index') }}" class="header-brand-item">
2323
<span class="header-brand-icon"></span>
2424
<span>GPU MODE</span>
2525
</a>
2626
<div class="header-item">
27-
<a href="{{ url_for('news') }}" class="header-link">
27+
<a href="{{ url_for('news.news') }}" class="header-link">
2828
News
2929
</a>
3030
</div>

kernelboard/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h1>Leaderboards</h1>
88

99
<div class="leaderboard-grid">
1010
{% for leaderboard in leaderboards %}
11-
<a href="{{ url_for('leaderboard', id=leaderboard['id']) }}" class="leaderboard-tile-link">
11+
<a href="{{ url_for('leaderboard.leaderboard', leaderboard_id=leaderboard['id']) }}" class="leaderboard-tile-link">
1212
<div class="leaderboard-tile">
1313
<div class="leaderboard-tile-name">
1414
{% set color = leaderboard['name']|to_color %}

0 commit comments

Comments
 (0)