From 247c8f7318a55855b5240fa47a4490a5f26070ed Mon Sep 17 00:00:00 2001 From: jp Date: Thu, 13 Aug 2026 13:39:07 +0100 Subject: [PATCH] fix: empty _Row truthy bug in add_contact UPSERT fetchone() returns an empty _Row on no match (no __bool__), so was always true and UPDATE ran with a nonexistent id, silently inserting nothing. Changed to so missing rows fall through to INSERT. --- src/vm_web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vm_web.py b/src/vm_web.py index d2f1abe..89ea30f 100644 --- a/src/vm_web.py +++ b/src/vm_web.py @@ -511,7 +511,7 @@ async def add_contact(request: Request, vm_session: str = Cookie(default=None)): row = con.execute( "SELECT id FROM contacts WHERE number_e164 = ?", (normalized,) ).fetchone() - if row: + if row and row.get("id"): con.execute( "UPDATE contacts SET name=?, email=?, updated_at=NOW() WHERE id=?", (name, email, row["id"]),