SAAS-596: Store file size and hash in database

Removed try/except while getting file size and hash
This commit is contained in:
drigato 2015-02-19 10:38:30 -05:00
parent 66a6a8f985
commit cc9e6efbca

View file

@ -99,19 +99,16 @@ class MetadataAnalyzer(Analyzer):
pass
# Get file size and md5 hash of the file
try:
metadata["filesize"] = os.path.getsize(filename)
metadata["filesize"] = os.path.getsize(filename)
with open(filename, 'rb') as fh:
m = hashlib.md5()
while True:
data = fh.read(8192)
if not data:
break
m.update(data)
metadata["md5_hash"] = m.hexdigest()
except (OSError, IOError) as e:
raise e
with open(filename, 'rb') as fh:
m = hashlib.md5()
while True:
data = fh.read(8192)
if not data:
break
m.update(data)
metadata["md5_hash"] = m.hexdigest()