Open
Description
Describe the bug
If path contains a 0 height shape, plugin removes that part of path.
To Reproduce
Steps to reproduce the behavior:
Example script:
import { optimize } from 'svgo';
const svg = optimize(
`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
<path d="m8 5.25v0m0 6v-3.5"/>
</svg>`,
{
plugins: ['convertPathData'],
}
);
console.log(svg.data);
Expected behavior
Expected path to contain first chunk with v0
, but actual output is:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="M8 11.25v-3.5"/></svg>
Note that path contains only last chunk of original path, first chunk is gone, resulting in missing dot shape in icon.
Desktop (please complete the following information):
- SVGO Version: 4.0.0, 3.3.2
- Node.js Version: 20.14.0
- OS: macOS 15.5
Additional context
Source icon used in example: https://github.com/jaynewey/charm-icons/blob/main/icons/info.svg
Metadata
Metadata
Assignees
Labels
No labels