You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Last year's PR #1880 fixed the issue with URL encoding of IDs in href or url(). However, in practical use, we found that due to differences in SVG export tools or improper use, the SVG files delivered by designers to developers often have references to graphics, gradients, etc., in url() that are not necessarily URL-encoded.
Here is one of my actual examples (with business desensitization):
I traced the code and found that during the search for reference IDs, only URL-encoded IDs were used, which led to the unencoded IDs not being matched. As a result, in subsequent processing, they were considered as unreferenced, useless nodes and were deleted.
Describe the bug
Last year's PR #1880 fixed the issue with URL encoding of IDs in
href
orurl()
. However, in practical use, we found that due to differences in SVG export tools or improper use, the SVG files delivered by designers to developers often have references to graphics, gradients, etc., inurl()
that are not necessarily URL-encoded.Here is one of my actual examples (with business desensitization):
After this SVG was processed by svgo, it became like this:
I traced the code and found that during the search for reference IDs, only URL-encoded IDs were used, which led to the unencoded IDs not being matched. As a result, in subsequent processing, they were considered as unreferenced, useless nodes and were deleted.
svgo/plugins/cleanupIds.js
Line 236 in 8d6385b
I will submit a PR shortly to fix this issue.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: