fix: normalize googlechat targets

This commit is contained in:
Peter Steinberger
2026-01-25 00:04:37 +00:00
parent 72858a5311
commit c147962434
4 changed files with 15 additions and 2 deletions

View File

@@ -6,8 +6,8 @@ export function normalizeGoogleChatTarget(raw?: string | null): string | undefin
if (!trimmed) return undefined;
const withoutPrefix = trimmed.replace(/^(googlechat|google-chat|gchat):/i, "");
const normalized = withoutPrefix
.replace(/^user:/i, "users/")
.replace(/^space:/i, "spaces/");
.replace(/^user:(users\/)?/i, "users/")
.replace(/^space:(spaces\/)?/i, "spaces/");
if (isGoogleChatUserTarget(normalized)) {
const suffix = normalized.slice("users/".length);
return suffix.includes("@") ? `users/${suffix.toLowerCase()}` : normalized;