Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix live photo exif data info

Abhinav2c7765c427e5
diff --git a/apps/photos/src/components/PhotoViewer/index.tsx b/apps/photos/src/components/PhotoViewer/index.tsx
index e876fbb27c..a9286a9fce 100644
--- a/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/apps/photos/src/components/PhotoViewer/index.tsx
@@ -290,18 +290,25 @@ function PhotoViewer(props: Iprops) {
}
function updateExif(file: EnteFile) {
- if (file.metadata.fileType !== FILE_TYPE.IMAGE) {
+ if (file.metadata.fileType === FILE_TYPE.VIDEO) {
setExif({ key: file.src, value: null });
return;
}
+ if (!file.isSourceLoaded) {
+ return;
+ }
+ const key =
+ file.metadata.fileType === FILE_TYPE.IMAGE
+ ? file.src
+ : (file.srcURLs.url as any).image;
if (
!file ||
!exifCopy?.current?.value === null ||
- exifCopy?.current?.key === file.src
+ exifCopy?.current?.key === key
) {
return;
}
- setExif({ key: file.src, value: undefined });
+ setExif({ key, value: undefined });
checkExifAvailable(file);
}
@@ -540,23 +547,29 @@ function PhotoViewer(props: Iprops) {
return;
}
try {
- if (file.isSourceLoaded) {
- exifExtractionInProgress.current = file.src;
- const fileObject = await getFileFromURL(
+ exifExtractionInProgress.current = file.src;
+ let fileObject: File;
+ if (file.metadata.fileType === FILE_TYPE.IMAGE) {
+ fileObject = await getFileFromURL(
file.src as string,
file.metadata.title
);
- const fileTypeInfo = await getFileType(fileObject);
- const exifData = await getParsedExifData(
- fileObject,
- fileTypeInfo
- );
- if (exifExtractionInProgress.current === file.src) {
- if (exifData) {
- setExif({ key: file.src, value: exifData });
- } else {
- setExif({ key: file.src, value: null });
- }
+ } else {
+ const url = (
+ file.srcURLs.url as { image: string; video: string }
+ ).image;
+ fileObject = await getFileFromURL(url, file.metadata.title);
+ }
+ const fileTypeInfo = await getFileType(fileObject);
+ const exifData = await getParsedExifData(
+ fileObject,
+ fileTypeInfo
+ );
+ if (exifExtractionInProgress.current === file.src) {
+ if (exifData) {
+ setExif({ key: file.src, value: exifData });
+ } else {
+ setExif({ key: file.src, value: null });
}
}
} finally {
diff --git a/apps/photos/src/types/file/index.ts b/apps/photos/src/types/file/index.ts
index a4a15e387a..8e24db033c 100644
--- a/apps/photos/src/types/file/index.ts
+++ b/apps/photos/src/types/file/index.ts
@@ -1,3 +1,4 @@
+import { SourceURLs } from 'services/download';
import {
EncryptedMagicMetadata,
MagicMetadataCore,
@@ -50,6 +51,7 @@ export interface EnteFile
isTrashed?: boolean;
key: string;
src?: string;
+ srcURLs?: SourceURLs;
msrc?: string;
html?: string;
w?: number;
diff --git a/apps/photos/src/utils/photoFrame/index.ts b/apps/photos/src/utils/photoFrame/index.ts
index ce1cb66cf0..ad6806ea70 100644
--- a/apps/photos/src/utils/photoFrame/index.ts
+++ b/apps/photos/src/utils/photoFrame/index.ts
@@ -76,6 +76,7 @@ export async function updateFileSrcProps(file: EnteFile, srcURLs: SourceURLs) {
file.isSourceLoaded = true;
file.isConverted = !srcURLs.isOriginal;
file.conversionFailed = !srcURLs.isRenderable;
+ file.srcURLs = srcURLs;
if (!isRenderable) {
return;
}