Skip to content

Commit

Permalink
fix: Ensure that _validate_file check is run
Browse files Browse the repository at this point in the history
.
  • Loading branch information
vivekashok1221 committed Oct 23, 2023
1 parent 3a2531c commit 42b29b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/backend/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@


def _validate_file(file: UploadFile) -> Literal[True]:
if file.filename is None:
raise HTTPException(status_code=400, detail="No filename provided.")
if file.size is not None and file.size > MAX_SIZE:
raise HTTPException(
status_code=413,
Expand All @@ -37,9 +39,7 @@ def _validate_file(file: UploadFile) -> Literal[True]:

async def _upload_to_storage(files: list[UploadFile], destination: str) -> list[str]:
for file in files:
if file.filename is None:
raise HTTPException(status_code=400, detail="No filename provided.")
_validate_file(file)
_validate_file(file)

urls = []
filenames = set()
Expand Down

0 comments on commit 42b29b9

Please sign in to comment.