fix(gallery): filter out files without exif data
Some checks failed
Build and Push Docker Image / build (push) Failing after 1m48s

This commit is contained in:
2026-05-16 16:53:19 +02:00
parent 801442f7e6
commit 3e10b8ab5e

View File

@@ -29,7 +29,8 @@ export default defineCachedEventHandler(
/\.(jpg|jpeg|png|webp)$/i.test(file),
);
const imagesWithExif = await Promise.all(
const imagesWithExif = (
await Promise.all(
imageFiles.map(async (filename) => {
const filePath = join(galleryDir, filename);
const rawExif = await exifr.parse(filePath, {
@@ -40,7 +41,10 @@ export default defineCachedEventHandler(
ifd1: false,
});
const exif = exifSchema.parse(rawExif);
if (!rawExif) return null;
const parsed = exifSchema.safeParse(rawExif);
if (!parsed.success) return null;
const exif = parsed.data;
return {
filename,
@@ -60,7 +64,8 @@ export default defineCachedEventHandler(
},
};
}),
);
)
).filter((img) => img !== null);
return imagesWithExif;
} catch (err) {