Skip to content

Commit c933b59

Browse files
authored
Merge pull request #42 from lutraconsulting/corrpted_date_after_download
added check if size of downloaded file is same as size file the server
2 parents 3634876 + 10a1fd1 commit c933b59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mergin/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,10 @@ def download_file_part(part):
11251125
shutil.copyfileobj(chunk, final)
11261126
os.remove(file_part)
11271127

1128+
if os.path.getsize(os.path.join(file_dir, basename)) != file['size']:
1129+
os.remove(os.path.join(file_dir, basename))
1130+
raise ClientError(f'Download of file {basename} failed. Please try it again.')
1131+
11281132
return file['path']
11291133

11301134
def delete_project(self, project_path):

0 commit comments

Comments
 (0)