Skip to content

Commit

Permalink
fix: rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Nov 21, 2024
1 parent 355a863 commit 3dea690
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/chainlit/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ async def upload_file(
assert file.filename, "No filename for uploaded file"
assert file.content_type, "No content type for uploaded file"

allowed_file_upload(file)
validate_file_upload(file)

file_response = await session.persist_file(
name=file.filename, content=content, mime=file.content_type
Expand All @@ -881,7 +881,7 @@ async def upload_file(
return JSONResponse(content=file_response)


def allowed_file_upload(file: UploadFile):
def validate_file_upload(file: UploadFile):
if config.features.spontaneous_file_upload is None:
return # TODO: if it is not configured what should happen?

Expand All @@ -891,11 +891,11 @@ def allowed_file_upload(file: UploadFile):
detail="File upload is not enabled",
)

allowed_file_upload_mime(file)
allowed_file_upload_max_size(file)
validate_file_mime_type(file)
validate_file_size(file)


def allowed_file_upload_mime(file: UploadFile):
def validate_file_mime_type(file: UploadFile):
if config.features.spontaneous_file_upload.accept is None:
return

Expand All @@ -918,7 +918,7 @@ def allowed_file_upload_mime(file: UploadFile):
)


def allowed_file_upload_max_size(file: UploadFile):
def validate_file_size(file: UploadFile):
if config.features.spontaneous_file_upload.max_size_mb is None:
return

Expand Down

0 comments on commit 3dea690

Please sign in to comment.