nodeca / probe-image-size

Get image size without full download. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD, ICO.
MIT License
978 stars 77 forks source link

ProbeError: unrecognized file format #57

Closed yolpsoftware closed 3 years ago

yolpsoftware commented 3 years ago

Environment: node 14.15.1 on Windows 10 probe-image-size: 7.1.0

Stacktrace:

   at ParserStream.parserEnd (my-repo\node_modules\probe-image-size\stream.js:39:28)
    at Object.onceWrapper (events.js:421:28)
    at ParserStream.emit (events.js:315:20)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

Code used:

import probeImageSize from 'probe-image-size';

const result = await probeImageSize("https://upload.wikimedia.org/wikipedia/commons/e/e7/Obcine_Slovenija_2007_Sveti_Jurij_v_Slovenskih_goricah.svg");
puzrin commented 3 years ago

More simple way to reproduce:

node ./support/dump.js https://upload.wikimedia.org/wikipedia/commons/e/e7/Obcine_Slovenija_2007_Sveti_Jurij_v_Slovenskih_goricah.svg
ProbeError: unrecognized file format
    at ParserStream.parserEnd (/home/vitaly/Dropbox/Coding/probe-image-size/stream.js:39:28)
    at Object.onceWrapper (events.js:421:28)
    at ParserStream.emit (events.js:315:20)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ECONTENT'

Probably a bug.

rlidwka commented 3 years ago

Fixed, thanks for reporting.

The problem was that that svg had byte order mark which we didn't expect.

puzrin commented 3 years ago

Released 7.1.1

yolpsoftware commented 3 years ago

This is fixed, thank you!

However, please see #61. There are other images which are still not working.