Skip to content

Commit

Permalink
Fixed privacy plugin not replacing occurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Mar 1, 2025
1 parent 3bd81bd commit 523922b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion material/plugins/privacy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def _fetch(self, file: File, config: MkDocsConfig):
# 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]
Expand Down Expand Up @@ -484,6 +484,9 @@ def _fetch(self, file: File, config: MkDocsConfig):
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:
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/privacy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def _fetch(self, file: File, config: MkDocsConfig):
# 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]
Expand Down Expand Up @@ -484,6 +484,9 @@ def _fetch(self, file: File, config: MkDocsConfig):
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:
Expand Down

0 comments on commit 523922b

Please sign in to comment.