Skip to content

Use of privacy plugin with git-revision-date-localized plugin & type of timeago causes build to fail #5778

@nint8835

Description

@nint8835

Context

No response

Bug description

Upon enabling both the privacy plugin and the git-revision-date-localized plugin, and setting the type value for git-revision-date-localized to timeago, attempting to build the site will begin failing with the following error:

Traceback (most recent call last):
  File "/home/nint8835/Development/privacy-bug-repro/venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 286, in build_command
    build.build(cfg, dirty=not clean)
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 304, in build
    files = config.plugins.on_files(files, config=config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 533, in on_files
    return self.run_event('files', files, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 507, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nint8835/Development/privacy-bug-repro/venv/lib/python3.11/site-packages/material/plugins/privacy/plugin.py", line 118, in on_files
    url = urlparse(script.path)
                   ^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'path'

This only occurs when specifically those 3 combination of things have been done. The issue can be worked around by:

  • Removing the type config on git-revision-date-localized or changing it to a different value, such as datetime
  • Removing the git-revision-date-localized plugin entirely
  • Removing the privacy plugin

Related links

Reproduction

example.zip

Steps to reproduce

  1. Install dependencies
  2. Run mkdocs serve or mkdocs build

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions