Files.Upload with magnet file always results in 401
ptheofan opened this issue · comments
as per axios it looks like the post request does not hit upload.put.io
. Instead, it hits api.put.io
I had the same issue.
Another problem is that the oauth_token should be sent as a url parameter.
A workaround would be to post the file using fetch (or any other way you prefer) and include the token.
const formData = new FormData();
formData.append('file', fs.createReadStream(file));
const response = await fetch(`https://upload.put.io/v2/files/upload?oauth_token=${this.api.token}`, {
method: 'POST',
body: formData,
});
and import
import FormData from 'form-data';
import fs from 'fs';
import fetch from 'node-fetch';
should be fixed in v8.35.1
, sorry for the late response...