diff --git a/packages/frontend/src/lib/ui/FileUpload.svelte b/packages/frontend/src/lib/ui/FileUpload.svelte index ea7db4d..afddf86 100644 --- a/packages/frontend/src/lib/ui/FileUpload.svelte +++ b/packages/frontend/src/lib/ui/FileUpload.svelte @@ -8,19 +8,20 @@ export let label: string = '' export let files: FileDTO[] = [] - function fileToDTO(file: File): FileDTO { + async function fileToDTO(file: File): Promise { return { name: file.name, size: file.size, type: file.type, - contents: file, + contents: new Uint8Array(await file.arrayBuffer()), } } async function onInput(e: Event) { const input = e.target as HTMLInputElement if (input?.files?.length) { - files = [...files, ...Array.from(input.files).map(fileToDTO)] + const toAdd = await Promise.all(Array.from(input.files).map(fileToDTO)) + files = [...files, ...toAdd] } } diff --git a/packages/frontend/src/lib/ui/ShowNote.svelte b/packages/frontend/src/lib/ui/ShowNote.svelte index f5fda15..5065c8f 100644 --- a/packages/frontend/src/lib/ui/ShowNote.svelte +++ b/packages/frontend/src/lib/ui/ShowNote.svelte @@ -3,7 +3,7 @@