@@ -154,6 +154,8 @@ async def start_upload(
154154 retries = 0
155155 quick_xor_hash = QuickXorHash ()
156156 result = {}
157+ total_uploaded_bytes = 0
158+ total_progress_bytes = 0
157159
158160 async for chunk in self ._file .content_stream :
159161 self ._buffer .buffer += chunk
@@ -168,7 +170,6 @@ async def start_upload(
168170 total_uploaded_bytes : total_uploaded_bytes
169171 + current_chunk_size
170172 ]
171- quick_xor_hash .update (chunk_view )
172173 try :
173174 chunk_result = await self ._async_upload_chunk (
174175 upload_session .upload_url ,
@@ -250,6 +251,7 @@ async def start_upload(
250251 await asyncio .sleep (2 ** retries )
251252 continue
252253 else :
254+ quick_xor_hash .update (chunk_view )
253255 if "file" in chunk_result : # last chunk, no more ranges
254256 result = chunk_result
255257 else :
@@ -265,8 +267,9 @@ async def start_upload(
265267 retries = 0
266268 self ._start += current_chunk_size
267269 total_uploaded_bytes += current_chunk_size
270+ total_progress_bytes += current_chunk_size
268271 if self ._progress_callback :
269- self ._progress_callback (total_uploaded_bytes )
272+ self ._progress_callback (total_progress_bytes )
270273
271274 # returned range is not what we expected, fix range
272275 if self ._start != (
@@ -292,9 +295,9 @@ async def start_upload(
292295 self ._buffer .buffer ,
293296 )
294297 self ._start += self ._buffer .length
295- total_uploaded_bytes += self ._buffer .length
298+ total_progress_bytes += self ._buffer .length
296299 if self ._progress_callback :
297- self ._progress_callback (total_uploaded_bytes )
300+ self ._progress_callback (total_progress_bytes )
298301 # except APIError:
299302 # await self._commit_file(upload_session)
300303
0 commit comments