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
Specific SVG causes SVGO to fail: TypeError: Cannot read properties of undefined (reading '0') Edit: Bug is worse than I thought, SVGO corrupts all SVGs before encountering the invalid SVG.
#1974
TypeError: Cannot read properties of undefined (reading '0')
at reflectPoint (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\plugins\convertPathData.js:1160:37)
at C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\plugins\convertPathData.js:802:43
at Array.filter (<anonymous>)
at filters (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\plugins\convertPathData.js:397:15)
at Object.enter (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\plugins\convertPathData.js:183:20)
at visit (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\lib\xast.js:52:30)
at visit (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\lib\xast.js:68:9)
at visit (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\lib\xast.js:61:7)
at invokePlugins (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\lib\svgo\plugins.js:25:7)
at Object.fn (C:\Users\username\AppData\Roaming\nvm\v21.6.2\node_modules\svgo\lib\svgo\plugins.js:57:7)
Expected behavior
SVGO optimizes the SVG.
Or in the case of optimizing a folder, SVGO gracefully recovers from the error when processing a directory containing a bad SVG and continues processing other SVGs in the folder.
Desktop (please complete the following information):
SVGO Version 3.2.0
NodeJs Version 21.6.2
OS: Windows 10 Pro x64 22H2 (OS Build 19045.4239)
Additional context
None
The text was updated successfully, but these errors were encountered:
futuremotiondev
changed the title
Specific SVG causes SVGO to fail: TypeError: Cannot read properties of undefined (reading '0')
Specific SVG causes SVGO to fail: TypeError: Cannot read properties of undefined (reading '0') Edit: Bug is worse than I thought, SVGO corrupts all SVGs before encountering the invalid SVG.
Apr 5, 2024
Update to this issue. The severity is much higher than I thought.
I found another SVG causing SVGO to fail, but the terrible part is when I process a folder of SVGs that also contains the "bad" SVG using svgo -r -f 'C:\Icons\SomeFolderWithSVGs\', SVGO deletes all data from valid SVGs up until it reaches the "bad" SVG. So it's corrupting completely valid SVGs and causing data loss.
I believe this is due to how Node handles the priority of events and stuff.
Can you elaborate on this? Is there any way to mitigate this behavior? I can't safely use SVGO in production if there is a chance that somewhere in the pipeline valid data gets wiped out.
Describe the bug
SVGO is choking on a specific SVG file.
To Reproduce
Steps to reproduce the behavior:
Or paste this into a new text file and save with an SVG extension:
svgo '.\Azure Media Player Audio Only B.svg'
Expected behavior
SVGO optimizes the SVG.
Or in the case of optimizing a folder, SVGO gracefully recovers from the error when processing a directory containing a bad SVG and continues processing other SVGs in the folder.
Desktop (please complete the following information):
Additional context
None
The text was updated successfully, but these errors were encountered: