From 814e5a182c2495d6a63c337e6e0f891dc762d0b5 Mon Sep 17 00:00:00 2001 From: Chaim Marcus Date: Thu, 26 Mar 2026 18:46:35 +0000 Subject: [PATCH] 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) --- server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.py b/server.py index a128549..9d57149 100644 --- a/server.py +++ b/server.py @@ -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: