Skip to content

Commit

Permalink
do not create blob urls to upload document files.
Browse files Browse the repository at this point in the history
instead use the originalFile from the clientFileBlob object
  • Loading branch information
daneryl committed Feb 7, 2025
1 parent ec65e16 commit 2f14a97
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions app/react/Library/actions/saveEntityWithFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@ const saveEntityWithFiles = async (entity: ClientEntitySchema, dispatch?: Dispat
const entityToSave = { ...entity, documents: oldDocuments };

const addedDocuments = await Promise.all(
(newDocuments as ClientBlobFile[]).map(async file => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
const blob = await fetch(file.data).then(async r => r.blob());
const newDocument = new File([blob], file.originalFile.name, { type: blob.type });
URL.revokeObjectURL(file.data);
return newDocument;
})
(newDocuments as ClientBlobFile[]).map(async file => file.originalFile)
);

return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 2f14a97

Please sign in to comment.