Spaces:
Sleeping
Sleeping
Commit ·
450a52b
1
Parent(s): 4a6c290
Fix PDF worker serving - add route to serve pdf.worker.min.js from frontend root
Browse files🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- backend/app.py +8 -0
backend/app.py
CHANGED
|
@@ -288,6 +288,14 @@ if os.path.exists(frontend_path):
|
|
| 288 |
if os.path.exists(assets_path):
|
| 289 |
app.mount("/assets", StaticFiles(directory=assets_path), name="assets")
|
| 290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
@app.get("/")
|
| 292 |
async def serve_frontend():
|
| 293 |
index_path = os.path.join(frontend_path, "index.html")
|
|
|
|
| 288 |
if os.path.exists(assets_path):
|
| 289 |
app.mount("/assets", StaticFiles(directory=assets_path), name="assets")
|
| 290 |
|
| 291 |
+
# Serve other static files from frontend root (like pdf.worker.min.js)
|
| 292 |
+
@app.get("/pdf.worker.min.js")
|
| 293 |
+
async def serve_pdf_worker():
|
| 294 |
+
pdf_worker_path = os.path.join(frontend_path, "pdf.worker.min.js")
|
| 295 |
+
if os.path.exists(pdf_worker_path):
|
| 296 |
+
return FileResponse(pdf_worker_path)
|
| 297 |
+
raise HTTPException(status_code=404, detail="PDF worker not found")
|
| 298 |
+
|
| 299 |
@app.get("/")
|
| 300 |
async def serve_frontend():
|
| 301 |
index_path = os.path.join(frontend_path, "index.html")
|