From c86527bd33363f2307ab9b68e91716ff6b2bd9ce Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 30 Apr 2024 10:29:14 +0700 Subject: [PATCH] fix: shorthand mention in backtick --- src/CONST.ts | 2 +- src/libs/ReportUtils.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 676faf2ba6e9..a8cf2693245f 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1895,7 +1895,7 @@ const CONST = { POLICY_ID_FROM_PATH: /\/w\/([a-zA-Z0-9]+)(\/|$)/, - SHORT_MENTION: new RegExp(`@[\\w\\-\\+\\'#@]+(?:\\.[\\w\\-\\'\\+]+)*`, 'gim'), + SHORT_MENTION: new RegExp(`@[\\w\\-\\+\\'#@]+(?:\\.[\\w\\-\\'\\+]+)*(?![^\`]*\`)`, 'gim'), }, PRONOUNS: { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 038357c86cbc..a057e4f3519f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3291,6 +3291,9 @@ function addDomainToShortMention(mention: string): string | undefined { function getParsedComment(text: string, shouldEscapeText?: boolean): string { const parser = new ExpensiMark(); const textWithMention = text.replace(CONST.REGEX.SHORT_MENTION, (match) => { + if (!Str.isValidMention(match)) { + return match; + } const mention = match.substring(1); const mentionWithDomain = addDomainToShortMention(mention); return mentionWithDomain ? `@${mentionWithDomain}` : match;