Skip to content

Commit

Permalink
chore: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhanus3133 committed Mar 13, 2024
1 parent 49b747e commit 9db0fef
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,16 @@ function notificationWidget($) {
}
klass = notificationReadStatus.get(elem.id);

// Used to convert absolute URLs in notification messages to relative paths
function convertMessageWithRelativeURL(htmlString) {
const parser = new DOMParser();
const doc = parser.parseFromString(htmlString, "text/html");
const links = doc.querySelectorAll("a");
const doc = parser.parseFromString(htmlString, 'text/html');
const links = doc.querySelectorAll('a');
links.forEach((link) => {
const absoluteUrl = link.getAttribute("href");
if (absoluteUrl) {
const url = new URL(absoluteUrl);
link.setAttribute("href", url.pathname);
const url = link.getAttribute('href');
if (url) {
const url = new URL(url);
link.setAttribute('href', url.pathname);
}
});
return doc.body.innerHTML;
Expand Down

0 comments on commit 9db0fef

Please sign in to comment.