From 334f548cbb57aac08303b68bbe36b6362f5d38fc Mon Sep 17 00:00:00 2001 From: Sosthene Date: Sun, 15 Jun 2025 22:58:55 +0200 Subject: [PATCH] [bug] Incorrect formatting of files in `ProfileModal` --- src/components/ProfileModal.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/ProfileModal.tsx b/src/components/ProfileModal.tsx index bfa855b..af29b85 100644 --- a/src/components/ProfileModal.tsx +++ b/src/components/ProfileModal.tsx @@ -2,6 +2,7 @@ import React, { useState, memo } from 'react'; import Modal from './modal/Modal'; import './ProfileModal.css'; import type { ProfileData } from '../sdk/models/ProfileData'; +import type { FileBlob } from '../sdk/models/Data'; interface ProfileModalProps { isOpen: boolean; @@ -34,10 +35,16 @@ function ProfileModal({ isOpen, onClose, onSubmit, initialData = {} }: ProfileMo if (type === 'file' && files) { // Assuming you want to handle a single file const file = files[0]; - setProfileData(prev => ({ - ...prev, - [name]: file - })); + file.arrayBuffer().then(arrayBuffer => { + const fileBlob: FileBlob = { + type: file.type, + data: new Uint8Array(arrayBuffer) + }; + setProfileData(prev => ({ + ...prev, + [name]: fileBlob + })); + }); } else { setProfileData(prev => ({ ...prev,