fix: [core Global] catch and log incomplete files

This commit is contained in:
Terrtia 2020-02-06 09:41:43 +01:00
parent 6b6c6a4d9e
commit fc58940ed6
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -114,9 +114,14 @@ if __name__ == '__main__':
print('File already exist {}'.format(filename)) print('File already exist {}'.format(filename))
publisher.warning('Global; File already exist') publisher.warning('Global; File already exist')
try:
with gzip.open(filename, 'rb') as f:
curr_file_content = f.read()
except EOFError:
publisher.warning('Global; Incomplete file: {}'.format(filename))
# discard item
continue
with gzip.open(filename, 'rb') as f:
curr_file_content = f.read()
curr_file_md5 = hashlib.md5(curr_file_content).hexdigest() curr_file_md5 = hashlib.md5(curr_file_content).hexdigest()
new_file_content = gunzip_bytes_obj(decoded) new_file_content = gunzip_bytes_obj(decoded)