From b13c95f2cb540da987d62c575acba95e73ffd2a4 Mon Sep 17 00:00:00 2001 From: mhh Date: Wed, 20 Dec 2023 11:54:08 +0100 Subject: [PATCH] Add explicit file length in form data for BLOBs --- src/messages/store/publish.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/messages/store/publish.ts b/src/messages/store/publish.ts index b725ad6b..685e1ab0 100644 --- a/src/messages/store/publish.ts +++ b/src/messages/store/publish.ts @@ -179,8 +179,8 @@ async function sendMessage(configuration: SignAndBroadcastConfiguration, fileObj }, sync: configuration.sync, }; - - form.append("file", fileObject); + const length = fileObject instanceof Blob ? fileObject.size : fileObject.length; + form.append("file", fileObject, { knownLength: length }); form.append("metadata", JSON.stringify(metadata)); const response = await axios.post(`${stripTrailingSlash(configuration.APIServer)}/api/v0/storage/add_file`, form, {