From 78f003f5b5efd1dc2fc42c80b72672537373471c Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr Date: Tue, 31 Mar 2026 12:18:58 +0200 Subject: [PATCH] fix: reject empty table name in register-table endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #8 — empty name created orphaned record that couldn't be deleted. --- app/api/admin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/admin.py b/app/api/admin.py index 9fb46fc..4d6a575 100644 --- a/app/api/admin.py +++ b/app/api/admin.py @@ -84,8 +84,10 @@ async def register_table( conn: duckdb.DuckDBPyConnection = Depends(_get_db), ): """Register a new table in the system.""" + if not request.name or not request.name.strip(): + raise HTTPException(status_code=422, detail="Table name cannot be empty") repo = TableRegistryRepository(conn) - table_id = request.name.lower().replace(" ", "_") + table_id = request.name.strip().lower().replace(" ", "_") if repo.get(table_id): raise HTTPException(status_code=409, detail=f"Table '{table_id}' already registered")