Skip to content

Commit

Permalink
🐛 Fix S3 upload not working
Browse files Browse the repository at this point in the history
  • Loading branch information
mawoka-myblock committed Jun 15, 2024
1 parent e3788c8 commit 7e5acf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions classquiz/routers/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,22 @@ async def upload_file(file: UploadFile = File(), user: User = Depends(get_curren
if user.storage_used > settings.free_storage_limit:
raise HTTPException(status_code=409, detail="Storage limit reached")
file_id = uuid4()
size = 0
file_size = len(await file.read())
file_obj = StorageItem(
id=file_id,
uploaded_at=datetime.now(),
mime_type=file.content_type,
hash=None,
user=user,
size=size,
size=file_size,
deleted_at=None,
alt_text=None,
)
await storage.upload(
file_name=file_id.hex,
file_data=file.file,
mime_type=file.content_type,
size=size,
size=file_size,
)
await file_obj.save()
await arq.enqueue_job("calculate_hash", file_id.hex)
Expand Down

0 comments on commit 7e5acf8

Please sign in to comment.