ImageOptim-CLI icon indicating copy to clipboard operation
ImageOptim-CLI copied to clipboard

crash on malformed png files

Open Fil opened this issue 5 years ago • 0 comments

Steps To Reproduce The Error

❯ echo "hello" > file.png
❯ imageoptim --imagealpha  file.png
i Running ImageAlpha...
! Command failed with exit code 2 (ENOENT): /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/57/f83bftsx79b9ylc2gzbdmdfw0000gp/T/imageoptim-cli/file.png

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    Error: Command failed with exit code 2 (ENOENT): /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/57/f83bftsx79b9ylc2gzbdmdfw0000gp/T/imageoptim-cli/file.png
        at makeError (/usr/local/Cellar/imageoptim-cli/3.0.2/libexec/lib/node_modules/imageoptim-cli/dist/imageoptim:6571:11)
        at handlePromise (/usr/local/Cellar/imageoptim-cli/3.0.2/libexec/lib/node_modules/imageoptim-cli/dist/imageoptim:6368:26)
        at process._tickCallback (internal/process/next_tick.js:68:7)

Expected Behaviour

ignore or report malformed png files

Actual Behaviour

crash

Version Numbers or N/A

  • macOS: 10.15.7
  • /Applications/ImageOptim.app: 1.8.8 (brew)
  • /Applications/ImageAlpha.app: 1.5.1 (brew)
  • /Applications/JPEGmini.app: N/A

Help Needed

would the test at https://github.com/JamieMason/ImageOptim-CLI/blob/e65bb4a24c23975297aac716cf77fc4b87827ef9/src/is-supported.ts#L4 be complemented by a magic number test on the actual file's contents?

Fil avatar Oct 05 '20 06:10 Fil