mirror of https://github.com/CIRCL/AIL-framework
fix: [core Global] catch and log incomplete files
parent
6b6c6a4d9e
commit
fc58940ed6
|
@ -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:
|
with gzip.open(filename, 'rb') as f:
|
||||||
curr_file_content = f.read()
|
curr_file_content = f.read()
|
||||||
|
except EOFError:
|
||||||
|
publisher.warning('Global; Incomplete file: {}'.format(filename))
|
||||||
|
# discard item
|
||||||
|
continue
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue