Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social plugin crashes when font autoloading is disabled #7118

Closed
4 tasks done
joserebelo opened this issue Apr 28, 2024 · 2 comments
Closed
4 tasks done

Social plugin crashes when font autoloading is disabled #7118

joserebelo opened this issue Apr 28, 2024 · 2 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@joserebelo
Copy link

joserebelo commented Apr 28, 2024

Context

Updated from v9.5.18 to v9.5.19

Bug description

The social plugin now fails when font autoloading is disabled:

Traceback (most recent call last):
  File "/storage/workspace/Freeyourgadget/website/.venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 284, in build_command
    build.build(cfg, dirty=not clean)
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 265, in build
    config = config.plugins.on_config(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 587, in on_config
    return self.run_event('config', config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 160, in on_config
    self.font = self._load_font(config)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 452, in _load_font
    name = config.theme.get("font", {}).get("text", "Roboto")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute 'get'

Related links

Reproduction

site_name: My Docs

theme:
  name: material
  font: false

plugins:
  - social

Steps to reproduce

  1. Use the social plugin
  2. Set font: false in the theme configuration
  3. Notice the build fails

Browser

No response

Before submitting

@squidfunk squidfunk added the bug Issue reports a bug label Apr 28, 2024
@squidfunk
Copy link
Owner

Thanks for reporting. Indeed, this seems to be a regression. Note that this does not happen in Insiders, only in the communiy edition. We'll look into it.

alexvoss added a commit to alexvoss/mkdocs-material-fork that referenced this issue Apr 28, 2024
squidfunk pushed a commit that referenced this issue Apr 29, 2024
#7117)

* fix: social plugin fonts on Windows (squidfunk #7085)

* fix: managed to edit in material instead of src

* added resource mgmt for ByteIO, comments

* formatted comment

* Fix for Social plugin crashes when font autoloading is disabled (#7118)
@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Apr 29, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants