🐛 Fixed storage

This commit is contained in:
Mawoka
2023-06-18 10:09:15 +02:00
parent 5f35adeec7
commit cebc43fc3b
5 changed files with 15 additions and 14 deletions
+1 -3
View File
@@ -48,8 +48,7 @@ async def calculate_hash(ctx, file_id_as_str: str):
print("Retry raised!")
raise Retry(defer=ctx["job_try"] * 10)
async for chunk in file_bytes:
async for c in chunk:
file.write(c)
file.write(chunk)
try:
if 0 < file_data.size < 20_970_000: # greater than 0 but smaller than 20mbytes
file_data.thumbhash = image_to_thumbhash(file)
@@ -63,7 +62,6 @@ async def calculate_hash(ctx, file_id_as_str: str):
while chunk := file.read(6400):
hash_obj.update(chunk)
file_data.hash = hash_obj.digest()
print("Got hash!")
await file_data.update()
file.close()
user: User | None = await User.objects.get_or_none(id=file_data.user.id)