probe-image-size
Advanced tools
Comparing version 7.1.0 to 7.1.1
@@ -9,2 +9,7 @@ # Changelog | ||
## [7.1.1] - 2021-05-27 | ||
### Fixed | ||
- Allow byte order mark at the start of SVG, #57. | ||
## [7.1.0] - 2021-04-15 | ||
@@ -195,2 +200,3 @@ ### Fixed | ||
[7.1.1]: https://github.com/nodeca/probe-image-size/compare/7.1.0...7.1.1 | ||
[7.1.0]: https://github.com/nodeca/probe-image-size/compare/7.0.1...7.1.0 | ||
@@ -197,0 +203,0 @@ [7.0.1]: https://github.com/nodeca/probe-image-size/compare/7.0.0...7.0.1 |
@@ -128,2 +128,3 @@ 'use strict'; | ||
var str = ''; | ||
var buf = null; // used to manage first chunk in IDENTIFY | ||
@@ -134,5 +135,23 @@ var parser = new Transform({ | ||
switch (state) { | ||
// identify step is needed to fail fast if the file isn't SVG | ||
case STATE_IDENTIFY: | ||
if (buf) { | ||
// make sure that first chunk is at least 4 bytes (to do BOM skip later), | ||
// last chunk was small | ||
chunk = Buffer.concat([ buf, chunk ]); | ||
buf = null; | ||
} | ||
if (data_len === 0 && chunk.length < 4) { | ||
// make sure that first chunk is at least 4 bytes (to do BOM skip later), | ||
// current chunk is small | ||
buf = chunk; | ||
break; | ||
} | ||
var i = 0, max = chunk.length; | ||
// byte order mark, https://github.com/nodeca/probe-image-size/issues/57 | ||
if (data_len === 0 && chunk[0] === 0xEF && chunk[1] === 0xBB && chunk[2] === 0xBF) i = 3; | ||
while (i < max && isWhiteSpace(chunk[i])) i++; | ||
@@ -139,0 +158,0 @@ |
@@ -17,2 +17,5 @@ 'use strict'; | ||
// byte order mark, https://github.com/nodeca/probe-image-size/issues/57 | ||
if (buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF) i = 3; | ||
while (i < max && isWhiteSpace(buf[i])) i++; | ||
@@ -19,0 +22,0 @@ |
{ | ||
"name": "probe-image-size", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"description": "Get image size without full download (JPG, GIF, PNG, WebP, BMP, TIFF, PSD)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74846
1943