Skip to content

Commit ff49d74

Browse files
committed
Fixed deprecation warning in privacy plugin
1 parent cff4a75 commit ff49d74

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

material/plugins/privacy/plugin.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,10 @@ def _queue(self, url: URL, config: MkDocsConfig, concurrent = False):
363363
else:
364364
self._fetch(file, config)
365365

366-
# Register external asset as file
367-
self.assets.append(file)
366+
# Register external asset as file - it might have already been
367+
# registered, and since MkDocs 1.6, trigger a deprecation warning
368+
if not self.assets.get_file_from_path(file.src_uri):
369+
self.assets.append(file)
368370

369371
# If the URL of the external asset includes a hash fragment, add it to
370372
# the returned file, e.g. for dark/light images - see https://t.ly/7b16Y

src/plugins/privacy/plugin.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,10 @@ def _queue(self, url: URL, config: MkDocsConfig, concurrent = False):
363363
else:
364364
self._fetch(file, config)
365365

366-
# Register external asset as file
367-
self.assets.append(file)
366+
# Register external asset as file - it might have already been
367+
# registered, and since MkDocs 1.6, trigger a deprecation warning
368+
if not self.assets.get_file_from_path(file.src_uri):
369+
self.assets.append(file)
368370

369371
# If the URL of the external asset includes a hash fragment, add it to
370372
# the returned file, e.g. for dark/light images - see https://t.ly/7b16Y

0 commit comments

Comments
 (0)