Skip to content

Commit

Permalink
fix: special character in mentioned user name causes crash (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Sep 13, 2023
1 parent 4449c1d commit 1144c5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ const getMentionUsers = <
}
return acc;
}, '');
return mentionUserString;

// escape special characters
return mentionUserString.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

return '';
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const renderText = <
if (userName) {
acc += `${acc.length ? '|' : ''}@${userName}`;
}
return acc;
return acc.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');
}, '')
: '';

Expand Down

0 comments on commit 1144c5b

Please sign in to comment.