Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
fetchを使用
Browse files Browse the repository at this point in the history
  • Loading branch information
takejohn committed Apr 7, 2024
1 parent ff9577f commit eb32fc1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/cdn/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ export default {
);

try {
const res = await axios.get(file.proxyURL, {
responseType: 'stream',
});
const res = await fetch(file.url);
const resData = await res.arrayBuffer();
const form = new FormData();
const filename = interaction.options.getString(
LANG.commands.upload.options.filename.name,
Expand All @@ -55,7 +54,7 @@ export default {
LANG.commands.upload.options.private.name,
) == true;
console.log(strFormat(LANG.commands.upload.isPrivateLog, [isPrivate]));
form.append('file', res.data, filename || file.name);
form.append('file', Buffer.from(resData), filename || file.name);
const res2 = await axios.post(config.cdnUploadURL, form, {
params: {
private: isPrivate,
Expand Down

0 comments on commit eb32fc1

Please sign in to comment.