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

This SVG causes SVGO to error: TypeError: Cannot read properties of undefined (reading '0') #2095

Open
futuremotiondev opened this issue Mar 7, 2025 · 2 comments
Labels

Comments

@futuremotiondev
Copy link

Describe the bug

Image

When processing the SVG above with SVGO, I get the following error:

TypeError: Cannot read properties of undefined (reading '0')
    at reflectPoint (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:1160:37)
    at C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:802:43
    at Array.filter (<anonymous>)
    at filters (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:397:15)
    at Object.enter (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:183:20)
    at visit (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\xast.js:52:30)
    at visit (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\xast.js:68:9)
    at visit (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\xast.js:61:7)
    at invokePlugins (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\svgo\plugins.js:25:7)
    at Object.fn (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\svgo\plugins.js:57:7)

To Reproduce
Steps to reproduce the behavior:

  1. Download this svg: FirefoxBW.zip
  2. Try to run SVGO on it. svgo .\FirefoxBW.svg
  3. See error

Expected behavior
I expected SVGO to gracefully recover from malformed input

Desktop (please complete the following information):

  • SVGO Version 3.3.2
  • NodeJs Version 23.9.0
  • OS: Windows 10 Pro x64 22H2 (OS Build 19045.5555)

Additional context

There is another bug report here #1863 that references the same issue, however there was a fix merged: #2054.

I'm not sure if this SVG has the same problem or if it's something else causing SVGO to break.

@w2xi
Copy link

w2xi commented Mar 7, 2025

I also have the same problem

@leonardcser
Copy link

I have the same problem with convertPathData. Excluding it from the config works.

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

3 participants