From 35ce96fb564ed03c146057e449f04d4f121f702e Mon Sep 17 00:00:00 2001 From: hailt Date: Thu, 12 Nov 2026 23:12:45 +0700 Subject: [PATCH] fix: mark aborted multipart jobs cancelled --- src/api/v1/uploads.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/api/v1/uploads.py b/src/api/v1/uploads.py index e08378e..e6a28e1 100644 --- a/src/api/v1/uploads.py +++ b/src/api/v1/uploads.py @@ -122,4 +122,15 @@ async def abort_multipart(project_id: str, body: MultipartAbort, db: AsyncSession = Depends(get_session)): await _project_slug(project_id, db) r2.abort_multipart(body.key, body.uploadId) + item = (await db.execute(select(UploadItem).where( + UploadItem.project_id == project_id, + UploadItem.r2_key == body.key, + UploadItem.multipart_upload_id == body.uploadId + ))).scalar_one_or_none() + if item is not None: + item.status = "cancelled" + job = await db.get(UploadJob, item.job_id) + if job is not None: + job.status = "cancelled" + await db.commit() return {"aborted": True}