From 125e7ec25d58fb624d04596e0445c8dcabb58835 Mon Sep 17 00:00:00 2001 From: goelakshita708 Date: Thu, 9 Jul 2026 20:11:06 +0530 Subject: [PATCH] Add cancellation check during repository download --- backend/app/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/app/main.py b/backend/app/main.py index 2727e5e..6e0c76d 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -450,6 +450,8 @@ async def download_to_path( try: with open(dest_path, "wb") as f: async for chunk in r.aiter_bytes(chunk_size=chunk_size): + if cancel_event and cancel_event.is_set(): + raise asyncio.CancelledError("Download cancelled by user") bytes_received += len(chunk) if bytes_received > MAX_UPLOAD_SIZE: raise HTTPException(