diff --git a/material/plugins/privacy/plugin.py b/material/plugins/privacy/plugin.py index d99fa782e6b..3ae8a5bb6ca 100644 --- a/material/plugins/privacy/plugin.py +++ b/material/plugins/privacy/plugin.py @@ -313,12 +313,19 @@ def replace(match: Match): file = self._queue(url, config) el.set("src", resolve(file)) + # Handle external image in SVG + if el.tag == "image": + url = urlparse(el.get("href")) + if not self._is_excluded(url, initiator): + file = self._queue(url, config) + el.set("href", resolve(file)) + # Return element as string return self._print(el) # Find and replace all external asset URLs in current page return re.sub( - r"<(?:(?:a|link)[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>", + r"<(?:(?:a|link|image)[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>", replace, output, flags = re.I | re.M ) diff --git a/src/plugins/privacy/plugin.py b/src/plugins/privacy/plugin.py index d99fa782e6b..3ae8a5bb6ca 100644 --- a/src/plugins/privacy/plugin.py +++ b/src/plugins/privacy/plugin.py @@ -313,12 +313,19 @@ def replace(match: Match): file = self._queue(url, config) el.set("src", resolve(file)) + # Handle external image in SVG + if el.tag == "image": + url = urlparse(el.get("href")) + if not self._is_excluded(url, initiator): + file = self._queue(url, config) + el.set("href", resolve(file)) + # Return element as string return self._print(el) # Find and replace all external asset URLs in current page return re.sub( - r"<(?:(?:a|link)[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>", + r"<(?:(?:a|link|image)[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>", replace, output, flags = re.I | re.M )