- Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open
Description
Context
No response
Bug description
When using the Insiders version of the Social plugin in combination with another plugin that creates generated files, it raises an AttributeError exception.
Generated files were added with mkdocs 1.6 and don't have an abs_scr_path attribute.
Related links
- MkDocs release notes: Enabling true generated files and expanding the File API
- Discussion: Social plugin: runtime error with virtual files
Reproduction
9.5.34+insiders.4.53.12-social-virtual-files-error.zip
The foo plugin used in the reproduction is defined as follows:
from mkdocs.plugins import BasePlugin from mkdocs.structure.files import File, Files, InclusionLevel class FooPlugin(BasePlugin): def on_files(self, files: Files, **kwargs): return files.append(File.generated( config=kwargs.get("config"), src_uri="foo.md", content="", inclusion=InclusionLevel.NOT_IN_NAV, )) Steps to reproduce
Run mkdocs build in the reproduction.
The build will fail with the following exception:
File "C:\git\mkdocs_material_insiders_minimal_reproduction\venv\Lib\site-packages\mkdocs\plugins.py", line 566, in run_event result = method(item, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\git\mkdocs_material_insiders_minimal_reproduction\venv\Lib\site-packages\material\plugins\social\plugin.py", line 180, in on_files if file.abs_src_path.startswith(_templates_dirpath()): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'startswith' Browser
No response
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction using the built-in info plugin.
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open