[bug] Actually pass the file object to wasm as bytes
This commit is contained in:
parent
accd427cab
commit
c4db22f626
@ -36,7 +36,7 @@ export function createKeyValueSection(title: string, id: string, isRoleSection =
|
|||||||
keyInput: HTMLInputElement,
|
keyInput: HTMLInputElement,
|
||||||
valueInput: HTMLInputElement,
|
valueInput: HTMLInputElement,
|
||||||
fileInput: HTMLInputElement,
|
fileInput: HTMLInputElement,
|
||||||
fileBlob: File | null
|
fileBlob: number[] | null
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
const inputStyle = 'flex: 1; height: 2.5rem; padding: 0.5rem; border: 1px solid #ccc; border-radius: 0.375rem;';
|
const inputStyle = 'flex: 1; height: 2.5rem; padding: 0.5rem; border: 1px solid #ccc; border-radius: 0.375rem;';
|
||||||
@ -92,7 +92,8 @@ export function createKeyValueSection(title: string, id: string, isRoleSection =
|
|||||||
fileInput.onchange = async () => {
|
fileInput.onchange = async () => {
|
||||||
const file = fileInput.files?.[0];
|
const file = fileInput.files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
rowState.fileBlob = file;
|
const buffer = await file.arrayBuffer();
|
||||||
|
rowState.fileBlob = Array.from(new Uint8Array(buffer));
|
||||||
|
|
||||||
valueInput.value = `📄 ${file.name}`;
|
valueInput.value = `📄 ${file.name}`;
|
||||||
valueInput.disabled = true;
|
valueInput.disabled = true;
|
||||||
@ -174,7 +175,7 @@ export function createKeyValueSection(title: string, id: string, isRoleSection =
|
|||||||
const key = row.keyInput.value.trim();
|
const key = row.keyInput.value.trim();
|
||||||
if (!key) continue;
|
if (!key) continue;
|
||||||
if (row.fileBlob) {
|
if (row.fileBlob) {
|
||||||
data[key] = row.fileBlob; // return the File as Blob
|
data[key] = row.fileBlob;
|
||||||
} else {
|
} else {
|
||||||
data[key] = row.valueInput.value.trim();
|
data[key] = row.valueInput.value.trim();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user