Skip to content

Commit

Permalink
DOMsubber: improve the check for SVG URLs
Browse files Browse the repository at this point in the history
The old regex on just the URL wouldn't pick up URLs with a query part on
the end.
  • Loading branch information
christianp committed Jan 17, 2025
1 parent c623f83 commit 18e185e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/scripts/jme-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,8 @@ DOMcontentsubber.prototype = {
} else if(element.hasAttribute('nosubvars')) {
return element;
} else if(tagName=='img') {
if(element.getAttribute('src').match(/.svg$/i)) {
const url = new URL(element.getAttribute('src'), window.location);
if(url.pathname.match(/\.svg$/i)) {
var object = element.ownerDocument.createElement('object');
for(var i=0;i<element.attributes.length;i++) {
var attr = element.attributes[i];
Expand Down

0 comments on commit 18e185e

Please sign in to comment.