diff --git a/material/plugins/privacy/plugin.py b/material/plugins/privacy/plugin.py index fc47fcada..106b9d203 100644 --- a/material/plugins/privacy/plugin.py +++ b/material/plugins/privacy/plugin.py @@ -433,7 +433,7 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]): # Intercept errors of type `ConnectionError` and `HTTPError` except Exception as error: log.warning(f"Couldn't retrieve {file.url}: {error}") - return + return False # Compute expected file extension and append if missing mime = res.headers["content-type"].split(";")[0] @@ -484,6 +484,9 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]): if not self._is_excluded(url, file): self._queue(url, config, concurrent = True) + # External asset was successfully downloaded + return True + # Patch all links to external assets in the given file def _patch(self, initiator: File): with open(initiator.abs_src_path, encoding = "utf-8-sig") as f: diff --git a/src/plugins/privacy/plugin.py b/src/plugins/privacy/plugin.py index fc47fcada..106b9d203 100644 --- a/src/plugins/privacy/plugin.py +++ b/src/plugins/privacy/plugin.py @@ -433,7 +433,7 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]): # Intercept errors of type `ConnectionError` and `HTTPError` except Exception as error: log.warning(f"Couldn't retrieve {file.url}: {error}") - return + return False # Compute expected file extension and append if missing mime = res.headers["content-type"].split(";")[0] @@ -484,6 +484,9 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]): if not self._is_excluded(url, file): self._queue(url, config, concurrent = True) + # External asset was successfully downloaded + return True + # Patch all links to external assets in the given file def _patch(self, initiator: File): with open(initiator.abs_src_path, encoding = "utf-8-sig") as f: