fix(frontend): render nested EXIF values instead of [object Object]

EXIF values can be arrays/objects (rationals, GPS, etc.); String(val) showed
"[object Object]". Render object/array values as JSON.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 14:55:12 +03:00
parent 2ef055a41a
commit 00f63697b0
+9 -1
View File
@@ -183,6 +183,14 @@
if (!iso) return '—'; if (!iso) return '—';
return new Date(iso).toLocaleString(); return new Date(iso).toLocaleString();
} }
// EXIF values may be nested arrays/objects (e.g. rationals, GPS); render those
// as JSON instead of the useless "[object Object]".
function formatExifValue(val: unknown): string {
if (val === null || val === undefined) return '—';
if (typeof val === 'object') return JSON.stringify(val);
return String(val);
}
</script> </script>
<svelte:head> <svelte:head>
@@ -312,7 +320,7 @@
<dl class="exif"> <dl class="exif">
{#each exifEntries as [key, val]} {#each exifEntries as [key, val]}
<dt>{key}</dt> <dt>{key}</dt>
<dd>{String(val)}</dd> <dd>{formatExifValue(val)}</dd>
{/each} {/each}
</dl> </dl>
</section> </section>