From d8c3bb2f1b458675b8430990a1c67f49a0cb8a28 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Thu, 8 Jan 2026 12:03:53 -0300 Subject: [PATCH] comms: fix guest renamer db sql quoting --- services/comms/guest-name-job.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/comms/guest-name-job.yaml b/services/comms/guest-name-job.yaml index d1466e5..f31f949 100644 --- a/services/comms/guest-name-job.yaml +++ b/services/comms/guest-name-job.yaml @@ -271,13 +271,13 @@ spec: with conn.cursor() as cur: cur.execute( "SELECT name FROM users WHERE name ~ %s", - (f\"^@\\\\d+:{SERVER_NAME}$\",), + (f"^@\\d+:{SERVER_NAME}$",), ) user_ids = [row[0] for row in cur.fetchall()] if not user_ids: return cur.execute( - \"SELECT user_id, displayname FROM profiles WHERE user_id = ANY(%s)\", + "SELECT user_id, displayname FROM profiles WHERE user_id = ANY(%s)", (user_ids,), ) profiles = {row[0]: row[1] for row in cur.fetchall()} @@ -287,7 +287,7 @@ spec: continue new = None for _ in range(30): - candidate = f\"{random.choice(ADJ)}-{random.choice(NOUN)}\" + candidate = f"{random.choice(ADJ)}-{random.choice(NOUN)}" if candidate not in existing_names: new = candidate existing_names.add(candidate) @@ -295,7 +295,7 @@ spec: if not new: continue cur.execute( - \"INSERT INTO profiles (user_id, displayname) VALUES (%s, %s) ON CONFLICT (user_id) DO UPDATE SET displayname = EXCLUDED.displayname\", + "INSERT INTO profiles (user_id, displayname) VALUES (%s, %s) ON CONFLICT (user_id) DO UPDATE SET displayname = EXCLUDED.displayname", (user_id, new), ) finally: