Skip to content

Possible SVG corruption by stripping "Line To" (L) command in pathย #1023

Closed

Description

@lagru

I think I encountered a case where minify (v2.24.13) corrupts an SVG's path during minification. At least in terms of how Firefox (154.0) and Inkscape (1.4.4) draw the SVG. I've prepared the minimal reproducer below.

repro.svg Image
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 409.6 321.5" width="200" height="200"><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="#f3b113" stroke-width="3.2" d="m26 33.1-.5 5.3L23 38l-.2 2.7-5.3-.5M15 37.5l-2.6-.2-.5 5.3 5.3.4.4-5.3zl.4-5.3-2.6-.2.4-5.3 5.3.5-.2 2.6 5.2.4.3-2.6 5.2.4-.4 5.3-5.3-.4.2-2.7"/></svg>

After minification with go.tacodewolff.nl/minify we get:

repro.min.svg Image
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 409.6 321.5" width="200" height="200"><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="#f3b113" stroke-width="3.2" d="m26 33.1-.5 5.3L23 38l-.2 2.7-5.3-.5M15 37.5l-2.6-.2-.5 5.3 5.3.4.4-5.3z.4-5.3-2.6-.2.4-5.3 5.3.5-.2 2.6 5.2.4.3-2.6 5.2.4-.4 5.3-5.3-.4.2-2.7"/></svg>

The only difference is a dropped l (4-5.3zl.4-5 to 4-5.3z.4-5).

I originally noticed this via hugo (v0.165.0+extended+withdeploy linux/amd64) which should use minify v2.24.16. I did not test this with minify's master branch, but could confirm the behavior with go.tacodewolff.nl/minify (v2.24.13) (see link above).

Hope this helps pinning down what's going on here. If you need more information or I missed something please let me know!

Activity

  1. lagru commented on Aug 24, 2026

    @lagru
    Author

    Might be a similar thing as in #269?

  2. tdewolff commented on Aug 24, 2026

    @tdewolff
    Owner

    Thanks for the report! I've fixed it and added some other corrections / additional improvements. Please let me know if you run into problems.

  3. added a commit that references this issue on Aug 24, 2026
    66b968c
  4. lagru commented on Aug 25, 2026

    @lagru
    Author

    Will do. But will probably take a while till this propagates to me. Thanks for the quick response and the maintenance in general. ๐Ÿ˜Š

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions