fix(ui): preserve ZWJ in emoji sanitization

This commit is contained in:
Marcus Widing 2026-03-19 11:36:12 +01:00
parent a0575539a0
commit dd874d52f6
2 changed files with 5 additions and 1 deletions

View File

@ -145,4 +145,8 @@ describe("resolveAgentEmoji", () => {
it("falls back to empty for control-only emoji strings", () => {
expect(resolveAgentEmoji({ identity: { emoji: "\u202E\u2066" } })).toBe("");
});
it("preserves ZWJ-composed compound emoji intact", () => {
expect(resolveAgentEmoji({ identity: { emoji: "👩‍💻" } })).toBe("👩‍💻");
});
});

View File

@ -221,7 +221,7 @@ export function agentLogoUrl(basePath: string): string {
return base ? `${base}/favicon.svg` : "favicon.svg";
}
const EMOJI_CONTROL_CHARS_RE = /[\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g;
const EMOJI_CONTROL_CHARS_RE = /[\u200B\u200C\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g;
function sanitizeEmojiValue(value: string): string {
const cleaned = value.replaceAll(EMOJI_CONTROL_CHARS_RE, "").trim();