JamieMason / ImageOptim-CLI

Make optimisation of images part of your automated build process
https://foldleft.io/image-tools
MIT License
3.45k stars 125 forks source link

Latest version 3.1.9 doesn't seem to properly escape the file paths it sends to the commands #202

Open henderea opened 7 months ago

henderea commented 7 months ago

Steps To Reproduce The Error

Try to run imageoptim on a path containing a space.

Expected Behaviour

It runs the task normally.

Actual Behaviour

It gives errors about not being able to open/copy/whatever the file paths, and can even sometimes create folders in the current working directory

Version Numbers or N/A

Help Needed

I think this bug is related to the change in 3.1.9 that moves it away from using execa to run the various operations. Version 3.1.7 works fine with filepaths that have spaces in them, so something in the 3.1.9 release broke that. It may be necessary to change the method being used from child_process or possibly do some escaping before passing things in. I'm not 100% sure what part of the 3.1.9 changes broke this.