Fix static file serving for favicon and other dist root files
This commit is contained in:
@@ -88,6 +88,11 @@ if os.path.exists(static_dir):
|
|||||||
|
|
||||||
raise HTTPException(status_code=404, detail="Not found")
|
raise HTTPException(status_code=404, detail="Not found")
|
||||||
|
|
||||||
|
# Check if requesting a static file from dist root (favicon, etc.)
|
||||||
|
static_file_path = os.path.join(static_dir, full_path)
|
||||||
|
if os.path.isfile(static_file_path) and not full_path.startswith("."):
|
||||||
|
return FileResponse(static_file_path)
|
||||||
|
|
||||||
# Serve SPA for all other routes (including /project/*)
|
# Serve SPA for all other routes (including /project/*)
|
||||||
index_path = os.path.join(static_dir, "index.html")
|
index_path = os.path.join(static_dir, "index.html")
|
||||||
if os.path.exists(index_path):
|
if os.path.exists(index_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user