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

Error: <path> attribute d: Expected arc flag ('0' or '1'), "M21 0H3a3 3 0 0-3 3 NaNvNaNa3 3…" #95

Open
BrunoQuaresma opened this issue Dec 21, 2020 · 6 comments

Comments

@BrunoQuaresma
Copy link

For some reason this SVG:

<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M21 0H3a3 3 0 00-3 3v18a3 3 0 003 3h18a3 3 0 003-3V3a3 3 0 00-3-3zm-.44 7.81l-10.5 10.5a1.5 1.5 0 01-2.12 0l-4.5-4.5a1.5 1.5 0 112.12-2.12L9 15.129l9.44-9.44a1.5 1.5 0 112.12 2.122z"/></svg>

is being parsed to

<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M21 0H3a3 3 0 0-3 3 NaNvNaNa3 3 0 3 3 NaN NaNhNaNa3 3 0 3-3 NaN NaNvNaNa3 3 0 0-3 NaN NaNzm-.44 7.81l-10.5 10.5a1.5 1.5 0 1-2.12 0 NaNL1.32 NaNa1.5 1.5 0 112.12-2.12 NaN NaNlNaN NaN NaN NaNa1.5 1.5 0 112.12 2.122"></path></svg>

I'm importing and using like this:

import CheckboxIcon from "./CheckboxIcon.svg"

.babelrc:

{
  "presets": ["next/babel"],
  "plugins": ["inline-react-svg"]
}
@ljharb
Copy link
Collaborator

ljharb commented Dec 22, 2020

that's a lot of NaNs in the d attribute. is there any chance the original svg isn't well-formed?

@BrunoQuaresma
Copy link
Author

@ljharb If you open the original svg that I posted previously in the browser, it works. I tried with other svgs as well but no success.

@ljharb
Copy link
Collaborator

ljharb commented Dec 22, 2020

Browsers are very forgiving; it’s possible an svg would work, but be invalid, just like html itself.

@BrunoQuaresma
Copy link
Author

I used the W3C validator and it looks good.
Screen Shot 2020-12-21 at 22 57 28

Code:

<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M21 0H3a3 3 0 00-3 3v18a3 3 0 003 3h18a3 3 0 003-3V3a3 3 0 00-3-3zm-.44 7.81l-10.5 10.5a1.5 1.5 0 01-2.12 0l-4.5-4.5a1.5 1.5 0 112.12-2.12L9 15.129l9.44-9.44a1.5 1.5 0 112.12 2.122z"/></svg>

@AhmedBHameed
Copy link

Any solution/workaround to this issue?

@frendly
Copy link

frendly commented Feb 15, 2021

0.7.2 is quite outdated. Update to v1.1 at least
svg/svgo#1185

and

See #35 and #34; svgo v1+ doesn't offer a synchronous mechanism, so we can't use it.

Additionally, every security issue you're referencing is a false positive that does not apply to this repo.
#66

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

No branches or pull requests

4 participants