Correct errors

This commit is contained in:
Filoji 2020-07-22 17:51:23 +02:00
parent 229551a218
commit 1689f73e89
1 changed files with 2 additions and 2 deletions

View File

@ -22,11 +22,11 @@ class Attachement(db.Model):
def __init__(self, file, comment):
self.name = file.filename
self.size = os.stat(file).st_size
self.hashed = str(hash_file(file))
self.hashed = hash_file(file)
self.comment = comment
def hash_file(file):
with open(file,"rb") as f:
bytes = f.read() # read entire file as bytes
hashed = hashlib.sha256(bytes).hexdigest()
hashed = sha256(bytes).hexdigest()
return hashed