Skip to content

Commit d359286

Browse files
committed
Fix EXIF data extraction
1 parent 2cced9f commit d359286

2 files changed

Lines changed: 47 additions & 32 deletions

File tree

src/lib/services/utils/media/image/exif.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { loadModule } from '$lib/services/app/dependencies';
2+
import { getAssetBlob } from '$lib/services/assets/info';
23
import { toFixed } from '$lib/services/utils/number';
34

45
/**
@@ -17,8 +18,9 @@ import { toFixed } from '$lib/services/utils/number';
1718
*/
1819
export const extractExifData = async (asset, kind) => {
1920
const isImage = kind === 'image';
21+
const blob = isImage ? await getAssetBlob(asset) : null;
2022

21-
if (!isImage || !asset.file) {
23+
if (!blob) {
2224
return { createdDate: undefined, coordinates: undefined };
2325
}
2426

@@ -30,7 +32,7 @@ export const extractExifData = async (asset, kind) => {
3032
longitude,
3133
DateTimeOriginal,
3234
CreateDate: timestamp = DateTimeOriginal,
33-
} = (await parse(asset.file).catch(() => {})) ?? {};
35+
} = (await parse(blob).catch(() => {})) ?? {};
3436

3537
return {
3638
createdDate: timestamp instanceof Date ? timestamp : undefined,

src/lib/services/utils/media/image/exif.test.js

Lines changed: 43 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)