🐛 修复主题静态资源错误回退
同步测试分支已验证的静态资源 404 回归修复,避免缺失或越界资源被 SPA 首页兜底为 200。
This commit is contained in:
1 parent
3c427b5408
commit
5483e3b494
2 files changed
+22
-1
No files matched your search
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user