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

Commit dafba4f

Browse files
committed
Added check for upload corruption
1 parent c92a012 commit dafba4f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

InfiniDrive.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,19 @@ def print_ascii_logo():
139139
infile.close()
140140

141141
upBar.finish()
142-
print('\nUpload complete!')
142+
143+
# If the number of fragments to expect from a file upload is known, verify that the upload is not corrupted.
144+
if totalFrags != 'an unknown number of':
145+
print('Verifying upload.')
146+
foundFrags = len(driveAPI.get_files_list_from_folder(driveAPI.get_service(), dirId))
147+
if(totalFrags != foundFrags):
148+
debug_log.write("----------------------------------------\n")
149+
debug_log.write("InfiniDrive detected upload corruption.\n")
150+
debug_log.write("Expected Fragments: " + str(totalFrags) + "\n")
151+
debug_log.write("Actual Fragments : " + str(foundFrags) + "\n")
152+
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.')
153+
154+
print('Upload complete!')
143155
print('To download, use the following folder ID: ' + dirId)
144156
elif len(sys.argv) == 2 and str(sys.argv[1]) == "list":
145157
filesList = driveAPI.list_files(driveAPI.get_service())

0 commit comments

Comments
 (0)