mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
ready to test
Testing Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -97,21 +97,22 @@ async function uploadFile({ buffer, originalname, mimetype, ownerType = "" }) {
|
||||
contentType: mimetype,
|
||||
});
|
||||
|
||||
const contentLength = await new Promise((resolve, reject) => {
|
||||
form.getLength((err, length) => (err ? reject(err) : resolve(length)));
|
||||
});
|
||||
|
||||
const data = await chibiRequest("/api/upload", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
...baseHeaders(),
|
||||
...form.getHeaders(), // ← axios needs these
|
||||
...form.getHeaders(),
|
||||
"Content-Length": contentLength,
|
||||
...(albumUuid ? { albumuuid: albumUuid } : {}),
|
||||
},
|
||||
data: form,
|
||||
});
|
||||
|
||||
return {
|
||||
uuid: data.uuid,
|
||||
url: data.url,
|
||||
name: data.name,
|
||||
};
|
||||
return { uuid: data.uuid, url: data.url, name: data.name };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user