Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that _validate_file check is run #54

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmaoo who even wrote this in the first place

_validate_file(file)

urls = []
filenames = set()
Expand Down