Reputation: 29020
I'm getting started with Spaces. I'm successfully uploading images from a node backend with s3client and a PutObjectCommand. PutObjectCommand requires a Bucket argument, and it works when I put projectName.bucketName. To my surprise (and distaste), this argument is prepended to the Key, and so finds itself as a root folder in the interface, then repeated in the URL of the uploaded image. Why is this, and can I turn it off?
This is my upload command...
const command = new PutObjectCommand({
Bucket: "simplyfirst.simplyfirst",
Key,
Body: arr,
ACL: "public-read",
ContentType: contentType
});
try {
const response = await s3Client.send(command);
console.log(response);
return NextResponse.json({newFilename:filename})
} catch (err) {
console.error(err);
return new NextResponse("Error", { status: 500 })
}
...which gives me this in Spaces...
...and this as an url...
Upvotes: 1
Views: 90