Merge pull request #2700 from yueguobin/fix/issue-2680-static-directory

fix: handle directory access for static web-ui routes
This commit is contained in:
Jeremy Grossmann 2026-05-03 17:56:50 +08:00 committed by GitHub
commit 5f9b469679
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ async def web_ui(file_path: str):
static = get_resource(file_path)
if static is None or not os.path.exists(static):
if static is None or not os.path.exists(static) or os.path.isdir(static):
static = get_resource(os.path.join("static", "web-ui", "index.html"))
if static is None:

View File

@ -73,7 +73,7 @@ def get_application() -> FastAPI:
application.include_router(index.router, tags=["Index"])
application.include_router(controller.router, prefix="/v3")
application.mount("/static", StaticFiles(packages=[('gns3server', 'static')]), name="static")
application.mount("/static", StaticFiles(packages=[('gns3server', 'static')], html=True), name="static")
application.mount("/v3/compute", compute_api, name="compute")
return application