]> acesimba.cloud Git - codebuddy-web.git/commitdiff
fix: 已上传文件按 task_id 正确解析所属会话任务名(load_tasks 实为 {tasks:[...]})
authorCodebuddy <codebuddy@localhost>
Mon, 17 Aug 2026 03:27:48 +0000 (11:27 +0800)
committerCodebuddy <codebuddy@localhost>
Mon, 17 Aug 2026 03:27:48 +0000 (11:27 +0800)
backend/app.py

index 1d88ed944dbface105eab62473f35bc1f7ecdb30..261bb18f6ca62a1610fe406bc34705897b3a0d1c 100644 (file)
@@ -813,7 +813,8 @@ async def list_uploads(request: Request):
     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():
@@ -829,8 +830,8 @@ async def list_uploads(request: Request):
                         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),