Fix FastAPI error due to File parameter collision
- Updated the imports in files.py to use UploadFile directly instead of aliasing File to UploadedFile - Simplified the upload_file endpoint parameter declaration to avoid conflicts - Removed unnecessary default value for UploadFile parameter
This commit is contained in:
parent
9e8f0a412f
commit
b9d7b6ef54
@ -1,4 +1,4 @@
|
|||||||
from fastapi import APIRouter, Depends, File as UploadedFile, HTTPException, status
|
from fastapi import APIRouter, Depends, UploadFile, HTTPException, status
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from typing import List
|
from typing import List
|
||||||
@ -14,7 +14,7 @@ router = APIRouter()
|
|||||||
|
|
||||||
@router.post("/", response_model=FileResponse, status_code=status.HTTP_201_CREATED)
|
@router.post("/", response_model=FileResponse, status_code=status.HTTP_201_CREATED)
|
||||||
async def upload_file(
|
async def upload_file(
|
||||||
file: UploadedFile = UploadedFile(...),
|
file: UploadFile,
|
||||||
db: Session = Depends(get_db),
|
db: Session = Depends(get_db),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user