Merge pull request #258 from ente-io/master

release
This commit is contained in:
abhinavkgrd 2021-11-30 11:51:04 +05:30 committed by GitHub
commit 03595c6888
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,9 +31,14 @@ export async function getExifData(
receivedFile: globalThis.File,
fileTypeInfo: FileTypeInfo
): Promise<ParsedEXIFData> {
const nullExifData: ParsedEXIFData = {
location: NULL_LOCATION,
creationTime: null,
};
try {
const exifData = await getRawExif(receivedFile, fileTypeInfo);
if (!exifData) {
return { location: NULL_LOCATION, creationTime: null };
return nullExifData;
}
const parsedEXIFData = {
location: getEXIFLocation(exifData),
@ -44,6 +49,10 @@ export async function getExifData(
),
};
return parsedEXIFData;
} catch (e) {
logError(e, 'getExifData failed');
return nullExifData;
}
}
export async function getRawExif(
@ -63,6 +72,7 @@ export async function getRawExif(
}
export function getUNIXTime(dateTime: Date) {
try {
if (!dateTime) {
return null;
}
@ -72,6 +82,9 @@ export function getUNIXTime(dateTime: Date) {
} else {
return unixTime;
}
} catch (e) {
logError(e, 'getUNIXTime failed', { dateTime });
}
}
function getEXIFLocation(exifData): Location {