diff --git a/lib/parse_stream/svg.js b/lib/parse_stream/svg.js index a62d602..1f092cb 100644 --- a/lib/parse_stream/svg.js +++ b/lib/parse_stream/svg.js @@ -160,6 +160,7 @@ module.exports = function () { var result = parseSvg(str); if (result) { + state = STATE_IGNORE; parser.push(result); parser.push(null); break; diff --git a/test/test_stream.js b/test/test_stream.js index d4b0548..be33fd3 100644 --- a/test/test_stream.js +++ b/test/test_stream.js @@ -95,4 +95,16 @@ describe('probeStream', function () { /unrecognized file format/ ); }); + + it('should not fail when processing svg in multiple chunks', async function () { + let stream = new Readable({ + read: function () { + this.push(''); + this.push(''); + this.push(null); + } + }); + + await probe(stream); + }); });