1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-12-18 10:25:58 +01:00

Fixed privacy plugin interop with generated files

This commit is contained in:
squidfunk 2024-12-16 11:16:09 +01:00
parent c97270c8f1
commit 968fbe1ae2
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
2 changed files with 10 additions and 0 deletions

View File

@ -268,6 +268,11 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]):
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:

View File

@ -268,6 +268,11 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]):
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: