try fix
This commit is contained in:
1 parent
2bc33e0971
commit
2285480e1a
1 file changed
+5
-1
@@ -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")
|
make_log("uploader_v1.5", f"Resuming upload session with ID: {upload_id}", level="INFO")
|
||||||
|
|
||||||
# Determine the temporary file path based on upload_id
|
# 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)
|
# Check current size of the temporary file (if it exists)
|
||||||
current_size = 0
|
current_size = 0
|
||||||
@@ -99,6 +99,10 @@ async def s_api_v1_5_storage_post(request):
|
|||||||
try:
|
try:
|
||||||
mode = 'wb' if is_new_upload else 'ab'
|
mode = 'wb' if is_new_upload else 'ab'
|
||||||
async with aiofiles.open(temp_path, mode) as out_file:
|
async with aiofiles.open(temp_path, mode) as out_file:
|
||||||
|
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:
|
async for chunk in request.stream:
|
||||||
await out_file.write(chunk)
|
await out_file.write(chunk)
|
||||||
new_size = os.path.getsize(temp_path)
|
new_size = os.path.getsize(temp_path)
|
||||||
|
|||||||
Reference in new issue
Block a user