Skip to content

Commit 523922b

Browse files
committed
Fixed privacy plugin not replacing occurrences
1 parent 3bd81bd commit 523922b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

material/plugins/privacy/plugin.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _fetch(self, file: File, config: MkDocsConfig):
433433
# Intercept errors of type `ConnectionError` and `HTTPError`
434434
except Exception as error:
435435
log.warning(f"Couldn't retrieve {file.url}: {error}")
436-
return
436+
return False
437437

438438
# Compute expected file extension and append if missing
439439
mime = res.headers["content-type"].split(";")[0]
@@ -484,6 +484,9 @@ def _fetch(self, file: File, config: MkDocsConfig):
484484
if not self._is_excluded(url, file):
485485
self._queue(url, config, concurrent = True)
486486

487+
# External asset was successfully downloaded
488+
return True
489+
487490
# Patch all links to external assets in the given file
488491
def _patch(self, initiator: File):
489492
with open(initiator.abs_src_path, encoding = "utf-8-sig") as f:

src/plugins/privacy/plugin.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _fetch(self, file: File, config: MkDocsConfig):
433433
# Intercept errors of type `ConnectionError` and `HTTPError`
434434
except Exception as error:
435435
log.warning(f"Couldn't retrieve {file.url}: {error}")
436-
return
436+
return False
437437

438438
# Compute expected file extension and append if missing
439439
mime = res.headers["content-type"].split(";")[0]
@@ -484,6 +484,9 @@ def _fetch(self, file: File, config: MkDocsConfig):
484484
if not self._is_excluded(url, file):
485485
self._queue(url, config, concurrent = True)
486486

487+
# External asset was successfully downloaded
488+
return True
489+
487490
# Patch all links to external assets in the given file
488491
def _patch(self, initiator: File):
489492
with open(initiator.abs_src_path, encoding = "utf-8-sig") as f:

0 commit comments

Comments
 (0)