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

styleguide - custom icons with id defined with single quotes cause 500 error when loading style guide #11895

Open
enzedonline opened this issue Apr 26, 2024 · 1 comment · May be fixed by #11903
Assignees
Labels

Comments

@enzedonline
Copy link

Issue Summary

If a registered custom icon uses single quotes to define the id, the all_icons context variable doesn't recognise the icon name (i.e. the name attribute is empty). These icons behave as expected elsewhere in the admin interface.

When the styleguide template loops through the custom icons, the icon template tag is called with an empty name attribute causing the 500 error (ref).

{% icon name=item.name classname="w-w-8 w-h-8" %}

Steps to Reproduce

Add a custom svg to your project with the id defined with single quotes:

<svg
   viewBox="0 0 1024 1024"
   id='icon-ban'
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
   <path
     d="M 734.4,825 199,289.6 C 154.2,352.2 128,429 128,512 c 0,212 172,384 384,384 83,0 159.8,-26.2 222.4,-71 z M 825,734.4 C 869.8,671.8 896,595 896,512 896,300 724,128 512,128 429,128 352.2,154.2 289.6,199 Z M 0,512 a 512,512 0 1 1 1024,0 512,512 0 1 1 -1024,0 z"
     style="stroke-width:2" 
   />
</svg>

Register the icon as per docs.

Browse the style guide - the error is thrown in the icon template tag due to missing icon name.

  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: Yes

Technical details

  • Python version: 3.1.2
  • Django version: 4.2.7
  • Wagtail version: 6.0.2
  • Browser version: Chrome 124
@enzedonline enzedonline added status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug labels Apr 26, 2024
@laymonage laymonage removed the status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. label Apr 29, 2024
@laymonage
Copy link
Member

Thank you, I can confirm that this issue exists. It's been around since 5.0 though, so we might only fix this for 6.1 and up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

2 participants