From ec4d4d96c01717964d0f1ee1b8ee29de86807229 Mon Sep 17 00:00:00 2001 From: Qi Ke Date: Wed, 28 Jan 2026 18:46:37 -1000 Subject: [PATCH] fix(signal): preserve group ID case sensitivity Base64 group IDs are case-sensitive. The normalizeSignalMessagingTarget function was lowercasing the entire group:ID string, which broke lookups for groups with mixed-case base64 IDs. This fix preserves the original case of the group ID while still normalizing the 'group:' prefix to lowercase. Fixes reaction failures with error: 'Group not found' when the lowercased ID doesn't match the actual group. --- src/channels/plugins/normalize/signal.test.ts | 13 +++++++++++++ src/channels/plugins/normalize/signal.ts | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/channels/plugins/normalize/signal.test.ts b/src/channels/plugins/normalize/signal.test.ts index 6f4aee049..6fd200f3d 100644 --- a/src/channels/plugins/normalize/signal.test.ts +++ b/src/channels/plugins/normalize/signal.test.ts @@ -29,4 +29,17 @@ describe("signal target normalization", () => { expect(looksLikeSignalTargetId("uuid:")).toBe(false); expect(looksLikeSignalTargetId("uuid:not-a-uuid")).toBe(false); }); + + it("preserves group ID case (base64 is case-sensitive)", () => { + // Base64 group IDs contain mixed case that must be preserved + expect(normalizeSignalMessagingTarget("group:igVOP2EJR1sBXYYwsLhif/AEMTJWtiDiTyu88GWP5ZQ=")).toBe( + "group:igVOP2EJR1sBXYYwsLhif/AEMTJWtiDiTyu88GWP5ZQ=", + ); + expect(normalizeSignalMessagingTarget("signal:group:ABC123xyz+/=")).toBe("group:ABC123xyz+/="); + }); + + it("normalizes group prefix case but preserves ID", () => { + expect(normalizeSignalMessagingTarget("GROUP:TestGroupId123=")).toBe("group:TestGroupId123="); + expect(normalizeSignalMessagingTarget("Group:MixedCase/+ABC=")).toBe("group:MixedCase/+ABC="); + }); }); diff --git a/src/channels/plugins/normalize/signal.ts b/src/channels/plugins/normalize/signal.ts index c8ff17da6..b32264f5f 100644 --- a/src/channels/plugins/normalize/signal.ts +++ b/src/channels/plugins/normalize/signal.ts @@ -9,7 +9,8 @@ export function normalizeSignalMessagingTarget(raw: string): string | undefined const lower = normalized.toLowerCase(); if (lower.startsWith("group:")) { const id = normalized.slice("group:".length).trim(); - return id ? `group:${id}`.toLowerCase() : undefined; + // Keep group ID case-sensitive (base64 is case-sensitive) + return id ? `group:${id}` : undefined; } if (lower.startsWith("username:")) { const id = normalized.slice("username:".length).trim();