@@ -22,8 +22,8 @@ def __init__(
22
22
self ,
23
23
upload_session : LargeFileUploadSession ,
24
24
request_adapter : RequestAdapter ,
25
- stream : BytesIO , # counter check this
26
- max_chunk_size : int = 409600 # 4 * 1024 * 1024 - use smaller chnuks for testing
25
+ stream : BytesIO ,
26
+ max_chunk_size : int = 409600
27
27
):
28
28
if not isinstance (upload_session , LargeFileUploadSession ):
29
29
raise TypeError ("upload_session must be an instance of LargeFileUploadSession" )
@@ -119,8 +119,6 @@ async def upload(self, after_chunk_upload: Optional[Callable] = None):
119
119
process_next = session
120
120
# determine the range to be uploaded
121
121
# even when resuming existing upload sessions.
122
- #range_parts = self.next_range[0].split("-") if self.next_range else ['0']
123
-
124
122
range_parts = self .next_range [0 ].split ("-" ) if self .next_range else ['0' , '0' ]
125
123
end = min (int (range_parts [0 ]) + self .max_chunk_size - 1 , self .file_size )
126
124
uploaded_range = [range_parts [0 ], end ]
@@ -186,7 +184,7 @@ async def next_chunk(self, file: BytesIO, range_start: int = 0, range_end: int =
186
184
info .headers .try_add ('Content-Range' , f'bytes { start } -{ end } /{ self .file_size } ' )
187
185
info .headers .try_add ('Content-Length' , str (len (chunk_data )))
188
186
info .headers .try_add ("Content-Type" , "application/octet-stream" )
189
- info .set_stream_content (bytes (chunk_data )) # Convert chunk_data to bytes
187
+ info .set_stream_content (bytes (chunk_data ))
190
188
error_map : Dict [str , int ] = {}
191
189
parsable_factory = LargeFileUploadSession
192
190
return await self .request_adapter .send_async (info , parsable_factory , error_map )
0 commit comments