Skip to content

Commit

Permalink
#541 feat: Add DOMPurify to sanitize URL in mediaMain.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kagemomiji committed Jul 16, 2024
1 parent edd4840 commit 4690937
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions airsonic-main/src/main/resources/templates/mediaMain.html
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,8 @@
feather.replace();
<!-- add title to feather icons-->
Array.from(document.querySelectorAll('svg.feather[title]')).forEach((element) => {
element.insertAdjacentHTML('afterbegin', `<title>${element.attributes.title.value}</title>`);
const title = DOMPurify.sanitize(element.attributes.title.value);
element.insertAdjacentHTML('afterbegin', '<title>' + title + '</title>');
});
}

Expand Down Expand Up @@ -921,7 +922,8 @@
$("#starMediaDir").empty().append(feather.icons.star.toSvg({title: svgTitle}));
}
Array.from(document.querySelectorAll('#starMediaDir svg.feather[title]')).forEach((element) => {
element.insertAdjacentHTML('afterbegin', `<title>${element.attributes.title.value}</title>`);
const title = DOMPurify.sanitize(element.attributes.title.value);
element.insertAdjacentHTML('afterbegin', '<title>' + title + '</title>');
});
}

Expand Down

0 comments on commit 4690937

Please sign in to comment.