enh: ALLOWED_FILE_EXTENSIONS ui

This commit is contained in:
Timothy Jaeryang Baek
2025-05-16 21:05:52 +04:00
parent 528a2cf96a
commit 2bd7db12a2
56 changed files with 256 additions and 3 deletions
+4
View File
@@ -97,6 +97,10 @@ def upload_file(
file_extension = os.path.splitext(filename)[1]
if request.app.state.config.ALLOWED_FILE_EXTENSIONS:
request.app.state.config.ALLOWED_FILE_EXTENSIONS = [
ext for ext in request.app.state.config.ALLOWED_FILE_EXTENSIONS if ext
]
if file_extension not in request.app.state.config.ALLOWED_FILE_EXTENSIONS:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,