Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix attachment uploading

Ammar Ahmedaecf4f1ee870
diff --git a/apps/mobile/app/common/filesystem/upload.ts b/apps/mobile/app/common/filesystem/upload.ts
index c55f8d87d..2695d8255 100644
--- a/apps/mobile/app/common/filesystem/upload.ts
+++ b/apps/mobile/app/common/filesystem/upload.ts
@@ -74,21 +74,6 @@ export async function uploadFile(
return true;
}
- const uploadUrlResponse = await fetch(url, {
- method: "PUT",
- headers
- });
-
- const uploadUrl = uploadUrlResponse.ok
- ? await uploadUrlResponse.text()
- : await uploadUrlResponse.json();
-
- if (typeof uploadUrl !== "string") {
- throw new Error(
- uploadUrl.error || "Unable to resolve attachment upload url."
- );
- }
-
DatabaseLogger.info(`Starting upload: ${filename}`);
const uploadRequest = RNFetchBlob.config({
@@ -97,8 +82,9 @@ export async function uploadFile(
})
.fetch(
"PUT",
- uploadUrl,
+ url,
{
+ ...headers,
"content-type": ""
},
RNFetchBlob.wrap(filePath)