I can add a file and get a successful response like:
{
Name: 'Screenshot 2021-10-14 160031.png',
Hash: 'QmXk1HX751jRWwj9Cv8Bt8fo9cahwrn7F7uY682eFuBWyT',
Size: '317573'
}
But when I query this hash URL:
https://ipfs.infura.io:5001/api/v0/get?arg=QmXk1HX751jRWwj9Cv8Bt8fo9cahwrn7F7uY682eFuBWyT
The browser downloads as “get” with wrong filename and no extension.
Do I have to use the Content-Disposition header to specify the filename too? I set the FormData filename.
Confused.
Javascript NodeJS code is like this:
const formData = new FormData();
formData.append("file", file.buffer, file.originalname);
const ipfsResponse = await fetch(infuraIpfs.endpoint + "/api/v0/add", {
method: "POST",
headers: {
Authorization: `${infuraIpfs.projectId}:${infuraIpfs.projectSecret}`,
ContentType: "multipart/form-data",
},
body: formData
})