🐛 修复主题静态资源错误回退

同步测试分支已验证的静态资源 404 回归修复,避免缺失或越界资源被 SPA 首页兜底为 200。
This commit is contained in:
Orion committed 2026-08-07 09:24:35 +08:00
1 parent 3c427b5408
commit 5483e3b494
2 files changed
+22 -1

No files matched your search

+2
View File
@@ -891,6 +891,8 @@ async def theme_asset(asset_path: str):
@app.exception_handler(404)
@app.get("/")
async def index(request=None, exc=None):
if request is not None and request.url.path.startswith(("/assets/", "/theme-assets/")):
return PlainTextResponse("Not found", status_code=404)
theme_dir = resolve_theme_root()
index_file = resolve_theme_file("index.html")
asset_version = str(int(index_file.stat().st_mtime))