Skip to content

Commit

Permalink
Handling usernames correctly when highlighting search results
Browse files Browse the repository at this point in the history
  • Loading branch information
TBG-FR committed Feb 12, 2021
1 parent 1366dc0 commit 59d41da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const renderBody = (msg, settings) => {
if (searchedText) {
const uuidv4 = require('uuid/v4');
const replacementText = uuidv4();
const safeTextRegex = new RegExp(`(?:href|title)="[^"]*(${ searchedText })[^"]*"`, 'gi');
const safeTextRegex = new RegExp(`(?:href|title|data-username)="[^"]*(${ searchedText })[^"]*"`, 'gi');

while (msg.match(safeTextRegex) !== null) {
msg = msg.replace(safeTextRegex, (str) => `${ str.replace(searchedText, replacementText) }`);
Expand Down

0 comments on commit 59d41da

Please sign in to comment.