Skip to content

Commit bce01df

Browse files
author
Danny Aguilar
committed
fix(imessage): add eslint-disable for intentional no-control-regex
1 parent 7a27434 commit bce01df

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

extensions/imessage/src/monitor/echo-cache.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ const SENT_MESSAGE_TEXT_TTL_MS = 4_000;
2424
const SENT_MESSAGE_ID_TTL_MS = 60_000;
2525

2626
// U+FFFD replacement characters and C0/C1 control characters that imsg injects when
27-
// extracting text from NSAttributedString (attributedBody column). Uses RegExp constructor
28-
// to keep Unicode escapes out of a regex literal (avoids no-control-regex). See: #61312, #61821
29-
const IMSG_GARBAGE_CHARS_RE = new RegExp(
30-
"[\\ufffd\\ufffe\\uffff\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f-\\u009f]+",
31-
"g",
32-
);
27+
// extracting text from NSAttributedString (attributedBody column). The pattern intentionally
28+
// matches control characters to strip garbage from echo cache keys. See: #61312, #61821
29+
// eslint-disable-next-line no-control-regex
30+
const IMSG_GARBAGE_CHARS_RE =
31+
/[\ufffd\ufffe\uffff\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]+/g;
3332

3433
function normalizeEchoTextKey(text: string | undefined): string | null {
3534
if (!text) {

0 commit comments

Comments
 (0)