Skip to content

If the user name contains any regex metacharacters, the ping highlighting does not work. #167

Open
@jvert

Description

@jvert

The highlightPing() function uses the user's name directly as a regex when replacing the text with the tag button. This breaks if the user's name contains any regex special characters, e.g. "John Vert (me!)"

quick & simple fix is to change highlightPing to escape the username

html = html.replace(new RegExp(pingText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), __createTag(pingText, userId));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions