fix: return 404 for missing assets instead of index.html fallback
Prevents MIME type mismatch when asset filenames change after rebuild. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -551,6 +551,9 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
path = '/index.html'
|
||||
file_path = os.path.join(DIST_DIR, path.lstrip('/'))
|
||||
if not os.path.isfile(file_path):
|
||||
# Only fallback to index.html for routes, not for asset files
|
||||
if path.startswith('/assets/') or '.' in path.split('/')[-1]:
|
||||
self._respond(404, {'error': 'Not found'}); return
|
||||
file_path = os.path.join(DIST_DIR, 'index.html')
|
||||
try:
|
||||
with open(file_path, 'rb') as f:
|
||||
|
||||
Reference in New Issue
Block a user