Skip to content

Social card previews break when SVG images present #96

@kovidgoyal

Description

@kovidgoyal

Here is the traceback

Traceback (most recent call last):
17
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sphinx/events.py", line 96, in emit
18
    results.append(listener.handler(self.app, *args))
19
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sphinxext/opengraph/__init__.py", line 254, in html_page_context
20
    context["metatags"] += get_tags(app, context, doctree, app.config)
21
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sphinxext/opengraph/__init__.py", line 165, in get_tags
22
    image_path = create_social_card(
23
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sphinxext/opengraph/socialcards.py", line 105, in create_social_card
24
    plt_objects = render_social_card(
25
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sphinxext/opengraph/socialcards.py", line 140, in render_social_card
26
    ) = create_social_card_objects(**kwargs_fig)
27
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sphinxext/opengraph/socialcards.py", line 274, in create_social_card_objects
28
    img = mpimg.imread(image)
29
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/matplotlib/image.py", line 1541, in imread
30
    with img_open(fname) as image:
31
  File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/PIL/Image.py", line 3283, in open
32
    raise UnidentifiedImageError(msg)
33
PIL.UnidentifiedImageError: cannot identify image file '/Users/runner/work/kitty/kitty/logo/kitty.svg'
34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions