Validate screenshot MIME and filename metadata

This commit is contained in:
ik
2026-09-03 08:17:00 +07:00
parent b73580c720
commit a7bfc7ee8d
5 changed files with 25 additions and 5 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ def add_screenshot(report_id: UUID, db: Db, screenshot: UploadFile = File()) ->
raise HTTPException(status_code=409, detail="screenshot already uploaded")
raw = screenshot.file.read(settings.screenshot_max_bytes + 1)
try:
report.screenshot_key = upload_screenshot(raw)
report.screenshot_key = upload_screenshot(raw, filename=screenshot.filename, content_type=screenshot.content_type)
except ScreenshotError as exc:
raise HTTPException(status_code=422, detail=str(exc)) from exc
db.commit()