Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
Added check for upload corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBerdik committed Apr 5, 2020
1 parent c92a012 commit dafba4f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion InfiniDrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,19 @@ def print_ascii_logo():
infile.close()

upBar.finish()
print('\nUpload complete!')

# If the number of fragments to expect from a file upload is known, verify that the upload is not corrupted.
if totalFrags != 'an unknown number of':
print('Verifying upload.')
foundFrags = len(driveAPI.get_files_list_from_folder(driveAPI.get_service(), dirId))
if(totalFrags != foundFrags):
debug_log.write("----------------------------------------\n")
debug_log.write("InfiniDrive detected upload corruption.\n")
debug_log.write("Expected Fragments: " + str(totalFrags) + "\n")
debug_log.write("Actual Fragments : " + str(foundFrags) + "\n")
print('InfiniDrive has detected that your upload was corrupted. Please report this issue on the InfiniDrive GitHub issue tracker and upload your "log.txt" file.')

print('Upload complete!')
print('To download, use the following folder ID: ' + dirId)
elif len(sys.argv) == 2 and str(sys.argv[1]) == "list":
filesList = driveAPI.list_files(driveAPI.get_service())
Expand Down

0 comments on commit dafba4f

Please sign in to comment.