1
Fork 0

Use strict equal when comparing exif values

This fixes a problem where flash values of 0 (no flash)
would not show up in the side bar
This commit is contained in:
viktorstrate 2021-03-29 11:57:57 +02:00
parent 1193222f92
commit da664c7766
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
1 changed files with 46 additions and 43 deletions

View File

@ -180,23 +180,23 @@ const flash = {
} }
// From https://exiftool.org/TagNames/EXIF.html // From https://exiftool.org/TagNames/EXIF.html
const orientation = { // const orientation = {
1: 'Horizontal (normal)', // 1: 'Horizontal (normal)',
2: 'Mirror horizontal', // 2: 'Mirror horizontal',
3: 'Rotate 180', // 3: 'Rotate 180',
4: 'Mirror vertical', // 4: 'Mirror vertical',
5: 'Mirror horizontal and rotate 270 CW', // 5: 'Mirror horizontal and rotate 270 CW',
6: 'Rotate 90 CW', // 6: 'Rotate 90 CW',
7: 'Mirror horizontal and rotate 90 CW', // 7: 'Mirror horizontal and rotate 90 CW',
8: 'Rotate 270 CW', // 8: 'Rotate 270 CW',
} // }
const SidebarContent = ({ media, hidePreview }) => { const SidebarContent = ({ media, hidePreview }) => {
let exifItems = [] let exifItems = []
if (media && media.exif) { if (media && media.exif) {
let exifKeys = Object.keys(exifNameLookup).filter( let exifKeys = Object.keys(exifNameLookup).filter(
x => !!media.exif[x] && x != '__typename' x => media.exif[x] !== undefined && x != '__typename'
) )
let exif = exifKeys.reduce( let exif = exifKeys.reduce(
@ -209,20 +209,23 @@ const SidebarContent = ({ media, hidePreview }) => {
exif.dateShot = new Date(exif.dateShot).toLocaleString() exif.dateShot = new Date(exif.dateShot).toLocaleString()
if (exposurePrograms.hasOwnProperty(exif.exposureProgram)) if (
{ exif.exposureProgram !== undefined &&
exif.exposureProgram !== 0 &&
exposurePrograms[exif.exposureProgram]
) {
exif.exposureProgram = exposurePrograms[exif.exposureProgram] exif.exposureProgram = exposurePrograms[exif.exposureProgram]
} }
if (exif.aperture) { if (exif.aperture !== undefined) {
exif.aperture = `f/${exif.aperture}` exif.aperture = `f/${exif.aperture}`
} }
if (exif.focalLength) { if (exif.focalLength !== undefined) {
exif.focalLength = `${exif.focalLength}mm` exif.focalLength = `${exif.focalLength}mm`
} }
if (flash.hasOwnProperty(exif.flash)) { if (exif.flash !== undefined && flash[exif.flash]) {
exif.flash = flash[exif.flash] exif.flash = flash[exif.flash]
} }