From 52ca60e240a50495e8ab873e5cf49af6284cec8d Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Sun, 11 Aug 2019 15:44:05 +0200 Subject: [PATCH] Fix bug where iso is not parsed at a number --- api/src/scanner/processImage.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/src/scanner/processImage.js b/api/src/scanner/processImage.js index 0865c6d4..6c43f15d 100644 --- a/api/src/scanner/processImage.js +++ b/api/src/scanner/processImage.js @@ -17,6 +17,16 @@ async function addExifTags({ session, photo }) { const rawTags = await exiftool.read(photo.path) + let iso = rawTags.ISO + if (typeof iso != 'Number') { + try { + iso = parseInt(iso) + } catch (e) { + console.log('Could not parse ISO as int', e, e.stack) + iso = undefined + } + } + const photoExif = { camera: rawTags.Model, maker: rawTags.Make, @@ -27,7 +37,7 @@ async function addExifTags({ session, photo }) { fileSize: rawTags.FileSize, exposure: rawTags.ShutterSpeedValue, aperture: rawTags.ApertureValue, - iso: rawTags.ISO, + iso, focalLength: rawTags.FocalLength, flash: rawTags.Flash, }