You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Relying on the provided python back-end example as starting point for my own one, I discovered that sometimes the final file on the server side was corrupted (e.g., a chunk could have been merged twice). So, debugging through well-placed print's, I finally understood that talking about chunks which could be uploaded in parallel, checking the existence of the chunks file was not enough to indicate that the entire upload was achieved; some chunks could be there but still in progress.
So, I changed this code block:
# check if the upload is completechunk_paths= [os.path.join(temp_dir, get_chunk_name(resumableFilename, x)) forxinrange(1, resumableTotalChunks+1)]
upload_complete=all([os.path.exists(p) forpinchunk_paths])
# combine all the chunks to create the final fileifupload_complete:
By this one:
# check if all chunks fully downloadedchunk_paths= [os.path.join(temp_dir, get_chunk_name(resumableFilename, x)) forxinrange(1, resumableTotalChunks+1)]
chunks_total=0chunks_size=0forchunk_pathinchunk_paths:
ifnotos.path.exists(chunk_path):
breakchunks_total+=1chunks_size+=os.stat(chunk_path).st_size# combine all the chunks to create the final fileif (chunks_total==resumableTotalChunks) and (chunks_size==resumableTotalSize):
This way, we ensure that reassembling the chunks is only operated when all the chunks are here and terminated for sure. Well... Sorry, I've no time to provide a pull request, but I wanted to let you know through this quick report (feel free to use it in your example if you want).
The text was updated successfully, but these errors were encountered:
Relying on the provided python back-end example as starting point for my own one, I discovered that sometimes the final file on the server side was corrupted (e.g., a chunk could have been merged twice). So, debugging through well-placed print's, I finally understood that talking about chunks which could be uploaded in parallel, checking the existence of the chunks file was not enough to indicate that the entire upload was achieved; some chunks could be there but still in progress.
So, I changed this code block:
By this one:
This way, we ensure that reassembling the chunks is only operated when all the chunks are here and terminated for sure. Well... Sorry, I've no time to provide a pull request, but I wanted to let you know through this quick report (feel free to use it in your example if you want).
The text was updated successfully, but these errors were encountered: