From 42b29b918d376db9a833783c22f13e91a8510e76 Mon Sep 17 00:00:00 2001 From: vivekashok1221 Date: Mon, 23 Oct 2023 22:33:10 +0400 Subject: [PATCH] fix: Ensure that _validate_file check is run . --- src/backend/storage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/storage.py b/src/backend/storage.py index d7d5491..1b4d115 100644 --- a/src/backend/storage.py +++ b/src/backend/storage.py @@ -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, @@ -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()