-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TypeError: Cannot read properties of undefined (reading '0') #1863
Comments
The issue is ultimately that the file is a valid SVG, but has invalid styles, from what I understand. Here is an MRE of the issue: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 225, 425">
<path style="fill- opacity:0.5" d="M0 50 l50 50 0 20z"/>
</svg> The parser encounters a CSS property, but the file jumps straight to declaring another CSS property rather than assigning a value to it. (This appears to be done pseudo-accidentally in the test suite by putting a line break in the middle of the property name.) I'm not sure if this should be resolved in CSSTree, CSSO, or SVGO. 🤔 |
Just open+save in inkscape to work around svg/svgo#1863
I also faced the same issue, the MRE that I come up with: <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 72 24">
<path d="M35 11 Q34.22 10.19 34.58 10.12 Q34.94 10.05 35.27 10.05 L35.27 10.05 Q35 10 36 10"/>
</svg> traceback:
|
I have the same issue, but only when I run over complete folder. It stops somewhere (every run differently) with the same error as @condemil and all processed SVG are empty. Processing each file individually works !? |
Attached file issue41.svg gives this error:
with this command
svgo issue41.svg
and also when opened here https://jakearchibald.github.io/svgomg/
(File is from the canvg test suite https://github.com/canvg/canvg/blob/master/test/svgs/issue41.svg )
The text was updated successfully, but these errors were encountered: