Skip to content

Commit

Permalink
Don't attempt to extract exif from png
Browse files Browse the repository at this point in the history
png does not store exif at the given offset
  • Loading branch information
styts committed Oct 27, 2017
1 parent 585ea7f commit a46cb5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ class Image {

const buffer = Buffer.concat(chunks)

// do not extract exif from png
let exifFn = (this.mimetype !== 'image/png') ? exif : () => ({})

Promise
.all([exif(buffer), NI(buffer), stat(this.path)])
.all([exifFn(buffer), NI(buffer), stat(this.path)])

.then(([data, original, file]) =>
assign(this, original.getSize(), { exif: data, original, file }))
Expand Down

0 comments on commit a46cb5a

Please sign in to comment.