Skip to content

Commit

Permalink
Fixed privacy plugin interop with generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Dec 16, 2024
1 parent c97270c commit 968fbe1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions material/plugins/privacy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ def _parse_media(self, initiator: File) -> list[URL]:
if extension not in self.assets_expr_map:
return []

# Skip if source path is not set, which might be true for generated
# files or for files that were added programatically in plugins
if not initiator.abs_src_path:
return []

# Find and extract all external asset URLs
expr = re.compile(self.assets_expr_map[extension], flags = re.I | re.M)
with open(initiator.abs_src_path, encoding = "utf-8-sig") as f:
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/privacy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ def _parse_media(self, initiator: File) -> list[URL]:
if extension not in self.assets_expr_map:
return []

# Skip if source path is not set, which might be true for generated
# files or for files that were added programatically in plugins
if not initiator.abs_src_path:
return []

# Find and extract all external asset URLs
expr = re.compile(self.assets_expr_map[extension], flags = re.I | re.M)
with open(initiator.abs_src_path, encoding = "utf-8-sig") as f:
Expand Down

0 comments on commit 968fbe1

Please sign in to comment.