also check file content_type
Build and publish bnuy api / build (push) Successful in 13m52s

This commit is contained in:
2026-05-16 20:44:23 +02:00
parent b2b43cb8cb
commit 9115c05573
+1 -1
View File
@@ -129,7 +129,7 @@ async def upload_image(file: UploadFile, request: Request, token: str = Depends(
raise HTTPException(status_code=401, detail="Unauthorized")
if not file:
raise HTTPException(status_code=400, detail="No file uploaded")
if not file.filename.lower().endswith(('.jpg', '.jpeg', '.png', '.gif')):
if not file.filename.lower().endswith(('.jpg', '.jpeg', '.png', '.gif')) or file.content_type not in ["image/jpeg", "image/png", "image/gif"]:
raise HTTPException(status_code=400, detail="Unsupported file type")
try:
content = await file.read()