fix: POST /api/contacts/add crashes on JSON null name/email (None.strip()) (#1544)

This commit is contained in:
Afonso Coutinho
2026-06-03 06:23:34 +01:00
committed by GitHub
parent f93755e7a4
commit 6e1df4ddc6
2 changed files with 44 additions and 2 deletions
+2 -2
View File
@@ -676,8 +676,8 @@ def setup_contacts_routes():
@router.post("/add")
async def add_contact(data: dict, _admin: str = Depends(require_admin)):
"""Add a new contact."""
name = data.get("name", "").strip()
email = data.get("email", "").strip()
name = (data.get("name") or "").strip()
email = (data.get("email") or "").strip()
if not email:
return {"success": False, "error": "Email required"}
# Check if already exists