if not _auth_ok(request):
return JSONResponse({"error": "unauthorized"}, status_code=401)
try:
- tasks = load_tasks()
+ tasks = load_tasks().get("tasks", [])
+ task_map = {t.get("id"): t.get("name", "") for t in tasks}
idx = load_uploads_index()
files = []
if PASTES_DIR.exists():
kind = "zip"
tid = idx.get(p.name, "")
tname = ""
- if tid and tid in tasks:
- tname = tasks[tid].get("name", "") or ""
+ if tid and tid in task_map:
+ tname = task_map.get(tid, "") or ""
st = p.stat()
files.append({
"name": p.name, "path": str(p),