gonefishin1 commited on
Commit
1cfc19b
·
verified ·
1 Parent(s): 4dc9390

Add debug listing to download endpoint

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -356,7 +356,20 @@ async def download_result(path: str = Query(...)):
356
  return JSONResponse({"error": "forbidden path"}, status_code=403)
357
 
358
  if not os.path.isfile(path):
359
- return JSONResponse({"error": "file not found"}, status_code=404)
 
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
  return FileResponse(path, media_type="video/mp4", filename=os.path.basename(path))
362
 
 
356
  return JSONResponse({"error": "forbidden path"}, status_code=403)
357
 
358
  if not os.path.isfile(path):
359
+ existing = glob.glob("/tmp/musetalk_*")
360
+ files_in_dirs = []
361
+
362
+ for d in existing:
363
+ if os.path.isdir(d):
364
+ for f in os.listdir(d):
365
+ files_in_dirs.append(os.path.join(d, f))
366
+
367
+ return JSONResponse({
368
+ "error": "file not found",
369
+ "requested": path,
370
+ "musetalk_dirs": existing[:10],
371
+ "files_in_dirs": files_in_dirs[:20],
372
+ }, status_code=404)
373
 
374
  return FileResponse(path, media_type="video/mp4", filename=os.path.basename(path))
375