Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SER-1602] Security Vulnerabilities and bugs #5370

Merged
merged 5 commits into from
Jul 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove jquery approach
  • Loading branch information
John-Weak committed Jul 1, 2024
commit e31e6b2010efc23f98d0e197bcf3e7cecd73debd
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@
var h = d.getHours();
var dow = d.getDay();
var symbol = 'emoji';

var encodeHtml = function (html) {
var div = document.createElement('div');
div.innerText = html;
return div.innerHTML;
};
if (!platform || (platform === "undefined") || (platform === "null")) {
platform = "Web";
}
Expand Down Expand Up @@ -236,10 +240,10 @@
}
if(consent && links && finalText){
//sanitize the text and links
finalText = $("<p>").text(finalText).text();
finalText = encodeHtml(finalText);
links.forEach(function (link) {
link.linkValue = $("<p>").text(link.linkValue).text();
link.textValue = $("<p>").text(link.textValue).text();
link.linkValue = encodeHtml(link.linkValue);
link.textValue = encodeHtml(link.textValue);
var regex = new RegExp('\\b' + link.textValue + '\\b', 'g');
finalText = finalText.replace(regex, '<a href="' + link.linkValue + '" target="_blank">' + link.textValue + '</a>');
});
John-Weak marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading