edit-meta: skip undefined EXIF

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/1010/head
Varun Patil 2024-01-10 14:59:20 -08:00
parent b94275030f
commit 921345523e
1 changed files with 9 additions and 0 deletions

View File

@ -273,6 +273,15 @@ export default defineComponent({
try { try {
// Update EXIF if required // Update EXIF if required
const raw = exifs.get(fileid) ?? {}; const raw = exifs.get(fileid) ?? {};
// Remove undefined keys
for (const key in raw) {
if ((raw as any)[key] === undefined) {
delete (raw as any)[key];
}
}
// Save EXIF if required
if (Object.keys(raw).length > 0) { if (Object.keys(raw).length > 0) {
const info = await axios.patch<IImageInfo>(API.IMAGE_SETEXIF(fileid), { raw }); const info = await axios.patch<IImageInfo>(API.IMAGE_SETEXIF(fileid), { raw });
dirty = true; dirty = true;