Escape name regex in message formatting function

This commit is contained in:
Cohee 2024-04-22 17:35:42 +03:00
parent 776260c85a
commit 6d1933c8f3
1 changed files with 1 additions and 1 deletions

View File

@ -1840,7 +1840,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser, messageId) {
*/ */
if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) { if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) {
mes = mes.replace(new RegExp(`(^|\n)${ch_name}:`, 'g'), '$1'); mes = mes.replace(new RegExp(`(^|\n)${escapeRegex(ch_name)}:`, 'g'), '$1');
} }
/** @type {any} */ /** @type {any} */