mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
web: upload direct to s3 via proxy
This commit is contained in:
@@ -300,20 +300,11 @@ async function singlePartUploadFile(
|
||||
console.log("Streaming file upload!");
|
||||
const { url, headers, signal } = requestOptions;
|
||||
|
||||
const uploadUrl: string | { error?: string } = await fetch(url, {
|
||||
method: "PUT",
|
||||
headers,
|
||||
signal
|
||||
}).then((res) => (res.ok ? res.text() : res.json()));
|
||||
if (typeof uploadUrl !== "string")
|
||||
throw new Error(
|
||||
uploadUrl.error || "Unable to resolve attachment upload url."
|
||||
);
|
||||
|
||||
const response = await axios.request({
|
||||
url: uploadUrl,
|
||||
url,
|
||||
method: "PUT",
|
||||
headers: {
|
||||
...headers,
|
||||
"Content-Type": ""
|
||||
},
|
||||
data: await fileHandle.toBlob(),
|
||||
|
||||
Reference in New Issue
Block a user