From 18e185e11d5fd900b90ebc54fc466e8db2388d54 Mon Sep 17 00:00:00 2001 From: Christian Lawson-Perfect Date: Fri, 17 Jan 2025 08:59:41 +0000 Subject: [PATCH] DOMsubber: improve the check for SVG URLs The old regex on just the URL wouldn't pick up URLs with a query part on the end. --- runtime/scripts/jme-variables.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/scripts/jme-variables.js b/runtime/scripts/jme-variables.js index 54c45eab5..30662a3a6 100644 --- a/runtime/scripts/jme-variables.js +++ b/runtime/scripts/jme-variables.js @@ -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