From 2285480e1a8e9d175f964199355f16026b5aa331 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 25 Feb 2025 17:15:12 +0300 Subject: [PATCH] try fix --- app/api/routes/progressive_storage.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/api/routes/progressive_storage.py b/app/api/routes/progressive_storage.py index 9521095..796159a 100644 --- a/app/api/routes/progressive_storage.py +++ b/app/api/routes/progressive_storage.py @@ -80,7 +80,7 @@ async def s_api_v1_5_storage_post(request): make_log("uploader_v1.5", f"Resuming upload session with ID: {upload_id}", level="INFO") # Determine the temporary file path based on upload_id - temp_path = os.path.join(UPLOADS_DIR, f"temp_{upload_id}") + temp_path = os.path.join(UPLOADS_DIR, f"v1.5_upload_{upload_id}") # Check current size of the temporary file (if it exists) current_size = 0 @@ -99,8 +99,12 @@ async def s_api_v1_5_storage_post(request): try: mode = 'wb' if is_new_upload else 'ab' async with aiofiles.open(temp_path, mode) as out_file: - async for chunk in request.stream: - await out_file.write(chunk) + data = request.body # Get the full body if available + if data: + await out_file.write(data) # Write the whole body at once + else: + async for chunk in request.stream: + await out_file.write(chunk) new_size = os.path.getsize(temp_path) make_log("uploader_v1.5", f"Appended chunk. New file size: {new_size}", level="INFO") except Exception as e: