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

Regression in 3.0.4: convertPathData breaks paths #1855

Closed
cyberalien opened this issue Nov 28, 2023 · 3 comments · Fixed by #1856
Closed

Regression in 3.0.4: convertPathData breaks paths #1855

cyberalien opened this issue Nov 28, 2023 · 3 comments · Fixed by #1856
Labels

Comments

@cyberalien
Copy link
Contributor

cyberalien commented Nov 28, 2023

Describe the bug

Source icon:

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8.5 12q1.05 0 1.75-.763t.975-1.812l-1.45-.35q-.125.55-.438.988T8.5 10.5q-.525 0-.838-.438t-.437-.987l-1.45.35q.275 1.05.975 1.813T8.5 12Zm3.5 5.5q.975 0 1.875-.438t1.675-1.312l-1.1-1q-.55.6-1.175.913T12 15.974q-.65 0-1.275-.312T9.55 14.75l-1.1 1q.8.875 1.688 1.313T12 17.5Zm3.5-5.5q1.05 0 1.75-.763t.975-1.812l-1.45-.35q-.125.55-.437.988t-.838.437q-.525 0-.838-.438t-.437-.987l-1.45.35q.275 1.05.975 1.813T15.5 12ZM12 22q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-10Zm0 8q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Z"/></svg>

sentiment-calm-outline

Icon optimised in 3.0.4 using only convertPathData plugin:

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8.5 12q1.05 0 1.75-.763t.975-1.812l-1.45-.35q-.125.55-.438.988T8.5 10.5q-.525 0-.838-.438t-.437-.987l-1.45.35q.275 1.05.975 1.813T8.5 12m3.5 5.5q.975 0 1.875-.438t1.675-1.312l-1.1-1q-.55.6-1.175.913T12 15.974q-.65 0-1.275-.312T9.55 14.75l-1.1 1q.8.875 1.688 1.313T12 17.5m3.5-5.5q1.05 0 1.75-.763t.975-1.812l-1.45-.35q-.125.55-.437.988t-.838.437q-.525 0-.838-.438t-.437-.987l-1.45.35q.275 1.05.975 1.813T15.5 12M12 22q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22m0 8q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20"/></svg>

sentiment-calm-outline_svgo4

The only optimisation here that I can see is removal of z, so most likely issue is caused by this: #1822 (edit: fixed link to correct pull request)

To Reproduce
Steps to reproduce the behavior:
optimize(src, {plugins: ['convertPathData']})

Desktop (please complete the following information):

  • SVGO Version: 3.0.4
  • NodeJs Version 20.5.0
  • OS: macOS 14.1.1

Additional context
Works correctly in 3.0.3

@KTibow
Copy link
Contributor

KTibow commented Nov 28, 2023

The issue seems to be caused by the meaningless instruction in the middle of the face getting removed
image

@cyberalien
Copy link
Contributor Author

It seems meaningless, but it does affect icon rendering, so it has some purpose.

I have no idea why it does that. Doesn't make any sense, but it does work.

@SethFalco
Copy link
Member

Thanks for reporting the issue! And thanks KTibow for solving it.
The fix will be released in SVGO v3.0.5. (ETA, 1 December 2023)

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

Successfully merging a pull request may close this issue.

3 participants