From 5cbba12850630a8725ae5b4e1c744ab44cd71e92 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 16 Dec 2022 16:57:02 +0530 Subject: [PATCH] dont check for exif in non image files --- src/components/PhotoViewer/FileInfo/index.tsx | 5 +++++ src/components/PhotoViewer/index.tsx | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/PhotoViewer/FileInfo/index.tsx b/src/components/PhotoViewer/FileInfo/index.tsx index b237844ec..5557225d4 100644 --- a/src/components/PhotoViewer/FileInfo/index.tsx +++ b/src/components/PhotoViewer/FileInfo/index.tsx @@ -88,6 +88,9 @@ export function FileInfo({ const closeExif = () => setShowExif(false); useEffect(() => { + console.log('file.metadata', file?.metadata); + console.log('location', location); + if (!location && file && file.metadata) { if (file.metadata.longitude || file.metadata.longitude === 0) { setLocation({ @@ -99,6 +102,8 @@ export function FileInfo({ }, [file]); useEffect(() => { + console.log('exif', exif); + console.log('location', location); if (!location && exif) { const exifLocation = getEXIFLocation(exif); if (exifLocation.latitude || exifLocation.latitude === 0) { diff --git a/src/components/PhotoViewer/index.tsx b/src/components/PhotoViewer/index.tsx index 285186fe6..c372a335b 100644 --- a/src/components/PhotoViewer/index.tsx +++ b/src/components/PhotoViewer/index.tsx @@ -307,6 +307,11 @@ function PhotoViewer(props: Iprops) { }); photoSwipe.listen('beforeChange', () => { const currItem = photoSwipe?.currItem as EnteFile; + updateFavButton(currItem); + if (currItem.metadata.fileType !== FILE_TYPE.IMAGE) { + setExif({ key: currItem.src, value: null }); + return; + } if ( !currItem || !exifCopy?.current?.value === null || @@ -316,10 +321,13 @@ function PhotoViewer(props: Iprops) { } setExif({ key: currItem.src, value: undefined }); checkExifAvailable(currItem); - updateFavButton(currItem); }); photoSwipe.listen('resize', () => { const currItem = photoSwipe?.currItem as EnteFile; + if (currItem.metadata.fileType !== FILE_TYPE.IMAGE) { + setExif({ key: currItem.src, value: null }); + return; + } if ( !currItem || !exifCopy?.current?.value === null ||