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

URL ID fixing broken for the ids #url, #ur, #rl, #u, #r, #l #64

Closed
MacDue opened this issue Mar 30, 2020 · 3 comments
Closed

URL ID fixing broken for the ids #url, #ur, #rl, #u, #r, #l #64

MacDue opened this issue Mar 30, 2020 · 3 comments
Labels

Comments

@MacDue
Copy link

MacDue commented Mar 30, 2020

Found this issue with some of my SVGs. Your id replacement code both fixPropWithUrl, and getHookedXlinkHref won't work with any of these ids: #url, #ur, #rl, #u, #r, #l.

This is because you just replace the old id with the new id in the prop:

return prop.replace(id, fixedId)

When my id is #l (so the prop is url(#l)) that results in something like ur___SVG_ID__2__10___(#l)

A simple fix would be to do

return `url(#${fixedId})`

Instead

@MacDue MacDue changed the title URL fixing broken for the ids #url, #ur, #rl, #u, #r, #l URL ID fixing broken for the ids #url, #ur, #rl, #u, #r, #l Mar 30, 2020
@MacDue
Copy link
Author

MacDue commented Mar 30, 2020

I have published a fixed package here: https://www.npmjs.com/package/svg-unique-id-react (since I needed it working)

Will take it down once this is patched.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@elderapo
Copy link
Owner

Thanks for reporting this bug. As bot said, the new fixed version has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants