mirror of
https://github.com/thumbsup/thumbsup
synced 2024-11-03 15:40:14 +00:00
fix(core): gracefully handle missing Exif.Composite.ImageSize
Fixes #226
This commit is contained in:
parent
c3ca18d97e
commit
59b539e38e
@ -133,7 +133,7 @@ function makeArray (value) {
|
|||||||
|
|
||||||
function dimensions (exif) {
|
function dimensions (exif) {
|
||||||
// Use the Composite field to avoid having to check all possible tag groups (EXIF, QuickTime, ASF...)
|
// Use the Composite field to avoid having to check all possible tag groups (EXIF, QuickTime, ASF...)
|
||||||
if (!exif.Composite) {
|
if (!exif.Composite || !exif.Composite.ImageSize) {
|
||||||
return {
|
return {
|
||||||
width: null,
|
width: null,
|
||||||
height: null
|
height: null
|
||||||
|
@ -228,11 +228,19 @@ describe('Metadata', function () {
|
|||||||
should(meta.height).eql(600)
|
should(meta.height).eql(600)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('defaults to null otherwise', function () {
|
it('defaults to null when there is no Composite data', function () {
|
||||||
const exiftool = fixtures.exiftool()
|
const exiftool = fixtures.exiftool()
|
||||||
const meta = new Metadata(exiftool)
|
const meta = new Metadata(exiftool)
|
||||||
should(meta.width).eql(null)
|
should(meta.width).eql(null)
|
||||||
should(meta.width).eql(null)
|
should(meta.width).eql(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('defaults to null when there is no ImageSize data', function () {
|
||||||
|
const exiftool = fixtures.exiftool()
|
||||||
|
exiftool.Composite = { Other: 'Data' }
|
||||||
|
const meta = new Metadata(exiftool)
|
||||||
|
should(meta.width).eql(null)
|
||||||
|
should(meta.width).eql(null)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user