Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Web part base 64 icons still do not render #1834
Expected or Desired Behavior
Web part icons defined in base 64 as described in the SPFx documentation page Configure web part icon (section Using a base64 encoded image) are displayed properly.
Web part icons defined in base 64 as defined in the mentioned article are not displayed at all in the web part picker. Unlike bug #1124, icons are not displayed properly in the local workbench.
Looking at the URL generated for the icon, the img src attribute appears to be prefixed with https://localhost:4321/ before the base64 encoded image. In fact, removing the https://localhost:4321/ from the src attribute renders the icon as expected.
For example, if source is:
Replacing it for:
will solve the issue.
The same behaviour can be observed on the local workbench and the hosted workbench.
Steps to Reproduce
Any news on this issue? I can still reproduce this issue. When I use a base64 encoded image it doesn't render.
But I am getting an sites/spappcatalog/ClientSideAssets/ea3aee20-489e-45d3-a637-c5071ede6dd7/data:image/svg+xml;base64 url when I used a base64 encoded image in my package.
I can confirm that this issue is solved for base64 raster images. However, the issue still seems to occur with base64-encoded SVGs.
If you need to use an embedded SVG for your icons, you need to convert them to data URIs, not base64-encoded.
There is a web-based utility to generate data URI SVGs at https://tahoeninjas.blog/2019/08/31/fixing-base64-svg-icons-in-spfx/
I hope it helps?