dont check for exif in non image files

This commit is contained in:
Abhinav 2022-12-16 16:57:02 +05:30
parent e491234f48
commit 5cbba12850
2 changed files with 14 additions and 1 deletions

View file

@ -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) {

View file

@ -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 ||